[fpc-pascal] How to solve "variable does not seem to be
initialized" compiler hint.
RainerStratmann at t-online.de
Thu Nov 19 22:50:31 CET 2009
Am Thursday 19 November 2009 22:40:53 schrieb Vinzent Höfler:
> Rainer Stratmann <RainerStratmann at t-online.de>:
> > For me a variable is initialised when it passes a procedure/function
> > which has a var declaration in the parameters.
> -- 8< --
> procedure Add_2 (var I : Integer);
> I := I + 2;
> -- 8< --
> If the variable for the parameter I wasn't correctly initialized before, it
> would still contain garbage upon return.
Yes, but for that is the compiler-switch $PASS_VAR_NO_HINT ON.
Then no hint is put out by the compiler.
If this switch is on the programmer is resposible for initialising variables
which pass a function.
If someone doesn't find it useful then he/she is not forced to use the switch.
I would use this switch if it exists. My code is full of this passing
variables through procedures/functions. And also I wonder of this many hints.
More information about the fpc-pascal