out vs. var (was: Re: [fpc-devel] Internal error in FPC 2.6.0rc1)

Michael Müller mueller_michael at alice-dsl.net
Mon Nov 28 12:02:09 CET 2011


Am 28.11.2011 um 01:05 schrieb Jonas Maebe:

> 
> On 28 Nov 2011, at 00:49, Michael Müller wrote:
> 
>> Beside that what is than the difference between 'out' and 'var'?
> 
> If you enable hints, the compiler will print a hint if it detects you passing a potentially uninitialized variable to a "var" parameter, while it won't print such a warning if you pass it to an "out" parameter.

But inside the routine with "out" parameter I had expected to get the same warning ;-). But this was before I learnt that at least something of an "out" parameter reaches the routine.

Why is this 'passing a potentially uninitialized variable to a "var" parameter' ('bla does not seem to be initialized') message a warning for arrays and a hint for basic types?

> Additionally, if you use the -gt command line option then the compiler will overwrite the contents of (non-reference-counted) out-parameters in the function entry code. This switch will do nothing for open array parameters though, because it lacks support for using the hidden "high" parameter to determine the bounds of the array at run time.

I don't understand this restriction. In the code High() works for open arrays at run time.

Regards

Michael


More information about the fpc-devel mailing list