[fpc-pascal] readonly variables
jonas.maebe at elis.ugent.be
Sun Nov 29 17:11:47 CET 2009
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).
More information about the fpc-pascal