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

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Jul 11 18:16:01 CEST 2016


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.


Jonas



More information about the fpc-pascal mailing list