[fpc-devel]Weird isn't it ?

Jonas Maebe jonas at zeus.rug.ac.be
Thu Feb 13 09:45:12 CET 2003

On donderdag, feb 13, 2003, at 01:32 Europe/Brussels, Maly wrote:

> well, exception handling isn't important, they'are handled outside
> this code and ChDir can't fail i.e raise any exception.
> The main question is why Write changes code execution/generation ?

In general this is due to you having an uninitialized variable 
somewhere. When you call write(), it write things to the stack, causing 
it to have different values that may accidentally give another variable 
a valid value later on. We've already had lots of bugreports that 
contained the comment that adding a write or read solved their problem 
and in (almost?) every case it was a bug somewhere in the submitter's 

It's quite possible that a Delphi generated program will not give the 
problem in this case, since the stack layout will be different (since 
it generates different code). That does not mean it's definitely a bug 
in FPC though (though of course it's possible).


More information about the fpc-devel mailing list