On 11 July 2016 at 18:35, Dennis Poon <den...@avidsoft.com.hk> wrote:

>
>
> 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?
>
> Dennis
>
>
The compiler might warn you about it, but it shouldn't initialize them out
for you.

Computers/compilers derive their power from being idiot savants and it is
wrong to make them anything other than that.

The compiler is supposed to implement what you say in the code, not what
you mean. You are the one who has the responsibility of expressing the
required states in as much detail as is possible.

-- 
Frank Church

=======================
http://devblog.brahmancreations.com
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to