[fpc-devel] Local boolean variables not always initalized with false by default?

theo xpde at theo.ch
Wed Sep 16 10:34:11 CEST 2009


Hello,

I don't know if this is a bug.

If fixed an old bug in the janSQL port.
http://forum.lazarus.freepascal.org/index.php/topic,6694.msg35412/
The problem was, that there was an uninitialized local boolean in

TjanSQL.selectFromJoin
...
var bAggregate:boolean;   

if you insert a
  writeln(bAggregate);  in Line 758 (start of procedure!) then you get a
'true'.

It's fixed now using bAggregate:=False; there.
See http://www.theo.ch/lazarus/janSQLLaz.zip

While uninitialized variables are certainly a bad thing, it's still a
bit strange why it defaults to 'true' in this case.
It was 'false' with Delphi.

Thanks.




More information about the fpc-devel mailing list