[fpc-devel] Redefine FillChar() to use out parameter instead

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Nov 19 11:44:35 CET 2009

On 19 Nov 2009, at 11:24, Graeme Geldenhuys wrote:

> Paul Ishenin wrote:
>> Compiler will add a flag for each var/const argument that they dont
>> require that checks.
> Can't the compiler simply initialize structured types by default?

The compiler already initialises the reference counted fields of  
structured types by default, because otherwise the code would crash.  
The rest is not initialised.

> Initialize char arrays to empty strings, other structures like  
> pointers
> to nil, byte arrays to #0 etc..?

Yes, the compiler can do that, at a cost. Here's the speed impact on  
the compiler itself: http://lists.apple.com/archives/objc-language/2009/Sep/msg00094.html 
  (a more "optimized version" turned out to be slower, because it  
zeroed more data).

> After all, this is already done for AnsString, Integer type, real  
> types
> etc...

It is done for reference counted types (such as ansistring,  
widestring, non-corba interfaces, ...). It is /not/ done for integer,  
real, etc.

You may be confused by the fact that all global variables are zero on  


More information about the fpc-devel mailing list