[fpc-pascal] Re: Blockread and buffers
yetanothergeek at gmail.com
Wed Mar 23 22:16:26 CET 2005
> BlockRead (Fin,buf,Sizeof(buf),NumRead);
> Should the buf be initialized (and if so - how)
Maybe like this:
FillByte(buf, Sizeof(buf), 0);
I tried the blockread example with FPC
v1.0.10, v1.9.6, v1.9.4, and v1.9.8
and none of them gives a warning here.
However, the example below gives me a similar warning
with 1.9.8, but not 1.9.6:
str(16, s); // Variable "s" does not seem to be initialized
Does "S" really need to be initialized ?
> > As I said - pure curiosity. Besides, we all know the dream
> > of a warning-free compilation. :)
> If you just want to feel nice with your code, you can disable the
> warnings at this piece of code, and re-enable it after, but take care
> to not change the code and make the warning become true =]
IMO, it is better/easier/safer to simply initialize
the variable than to disable the warning.
More information about the fpc-pascal