[fpc-devel]SizeOf() reports 0 for Var Paramaters. (1.1)

Marco van de Voort marcov at stack.nl
Sun Jul 27 16:25:03 CEST 2003

> I'm not certain but I'm pretty sure that under 1.0.6 SizeOf() reported the 
> proper size for Var paramaters.  If not then I think a compiler warning may 
> be in order for code like this... because I just spent an hour tracking down 
> this problem. ;)  Is there any other way of determining the original size of 
> the var param?

IIRC it returns correct data for _typed_ open arrays, not for "generic"
open arrays.

So for

proceduer bla(var a: array of longint);		 
// high() and sizeof() are possible

and for

procedure bla(var a);			
// none.

I'm pretty certain it was the same for 1.0.6. This was already the
case in BP/TP (e.g. see the blockwrite and blockread procedures that
require the length to be explicitely passed)

More information about the fpc-devel mailing list