[fpc-pascal] can the compiler zero any out parameter of procedure/function automatically?

Dennis Poon dennis at avidsoft.com.hk
Mon Jul 11 19:35:52 CEST 2016

Jonas Maebe wrote:
> Dennis wrote:
>> I know it is my responsibility to initialize out parameters, but I think
>> the compiler could help us by initializing all out parameters.
> The compiler will fill out-parameters with garbage if you use the -gt
> command line parameter, which can help you detect such problems more easily.
> If you forget to assign a value to an out-parameter in a particular
> case, having it return nil by default could easily be just as wrong as
> it returning any other random value. For that reason, there is no
> support for automatically initialising out-parameters.
How about issue a compiler warning if one forgets to zero any out parameter?


More information about the fpc-pascal mailing list