Marc van Woerkom wrote:
This is indeed only detected when the compiler is tracking each variable carefully enough - which is the case only with optimization. BTW, global variables are never considered uninitialized because they are initialized to zero (or Nil or false or empty string or ...) at the beginning of the program.
I have no problems with it, as a TP and C++ vet, but the Pascal purists do ..
When I used gpc for a problem in a programming course recently, I got some points deducted, because of an unitialized variable (FeldMax in the example below), the use of the 'ö' Umlaut in the comment at the beginning and (this gpc is not supposed to check :) the waste of an array for determing the maximum.
Don't get this wrong, but...
Better don't rely too much on the compiler's checks and warnings in a programming course, to train yourself to be more careful. It's better to learn programming without so much compiler assistance and later use all the compiler's features for production compiling, than relying on the checks and perhaps sometime later having to do some work in an environment without so many checks available...
Frank
Better don't rely too much on the compiler's checks and warnings in a programming course, to train yourself to be more careful.
Your adivce is certainly well meant, but I love a compiler to have strong warnings.
Comes in quite handy sometimes.
Mentioning the course was misleading, for I started coding in 1980 and did quite some Pascal in the past, until I switched to C++ in 1990.
Learnt UCSD Pascal on Apple ][ in 1982 (a Jensen/Wirth should be in some box in my cellar), Kyan Pascal, Turbo Pascal, Borland Pascal.
Even managed to annoy Wirth himself, when I studied physics in Aachen - he gave a talk on his new Oberon stuff and I could not keep my mouth shut. :)
Regards, Marc