[fpc-devel] Question about local variables initialization
pascaldragon at googlemail.com
Sat Sep 20 09:39:49 CEST 2014
Am 20.09.2014 04:40 schrieb "Gennady Agranov" <gennadyagranov at gmail.com>:
> I do not have clear picture about initialization of local variables - are
they initialized to some default value or not - and is there a way to
assure that every local variable (including record types) is set to some
> Of course the safest approach is to assume that everything is not
initialized and filled with garbage.
> Is it always true? E.g. is there a way control initialization of record
variables on stack?
Local variables are not initialized, except managed variables like
interfaces, arrays and AFAIK Strings.
You can manually initialize them though like you can global variables (the
generated code is however not much different from initializing them
yourself inside the function body unlike for global variables).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel