On Sun, Nov 29, 2009 at 1:11 PM, Jonas Maebe <jonas.ma...@elis.ugent.be> wrote: > > On 29 Nov 2009, at 16:51, Anthony Walter wrote: > >> Having said all that, Jonas, what is the actual implemented behaviour >> of FPC? Does it 0 initialize heap memory at startup or not? > > I guess you mean global data rather than heap (heap is what is handled by > getmem/freemem/..., and there are no guarantees regarding that memory). > > FPC currently initialises the global data to 0 on platforms that do not do > this by themselves. When it turns global variables into register variables, > it will also initialise such registers with 0. > >> If not, >> what is the justification for not doing so when this has been a long >> established behaviour of Delphi? > > A justification could be that it causes code bloat in case of register > variables, and that platforms which do not zero global data memory by > themselves are usually embedded devices where every operation counts (both in > terms of code size and in terms of energy usage). > > > Jonas_______________________________________________
FWIW, IIRC the last time this issue (global variables initialization) came up some FPC developer explained this was a platform specific behavior and shouldn't be counted on, so I thought MvC was right in this thread up to now... -Flávio _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal