[fpc-pascal] Over-zealous Warning about dynamic string initialization
Jonas Maebe
jonas.maebe at elis.ugent.be
Fri Nov 1 18:34:28 CET 2013
On 01/11/13 17:57, Howard Page-Clark wrote:
> var
> s:ansistring;
>
> begin
> WriteLn('s <',s,'> always seems to be initialized to ''''');
> end.
>
> produces a Warning
>
> Warning: Variable "s" does not seem to be initialized
>
> Can this Warning be disabled for compiler-managed variables?
The point of the warning is that you did not assign a value to the
variable, not necessarily that the contents are unknown. You get the
same warning for global variables if you only use them in a main
program. Removing unnecessarily assigning an empty string to such values
would be a job for the compiler (which it currently does not yet do).
Jonas
More information about the fpc-pascal
mailing list