lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] [bug #20254] Initializing static/global variables


From: Jonathan Larmour
Subject: Re: [lwip-devel] [bug #20254] Initializing static/global variables
Date: Mon, 30 Jul 2007 22:03:18 +0100
User-agent: Thunderbird 1.5.0.12 (X11/20070530)

Jonathan Larmour wrote:
Goldschmidt Simon wrote:

Note that many pieces of embedded software that are supposed to be
ultra-portable provide compile switches whether to initialize the data
or not. I'll try to search for some C definition if the initialization
to zero is mandatory or not.

It is mandatory.

I just noticed this is ambiguous - it's not clear what we're saying is doing the init to 0 :-). What is mandatory is that any static or global with no immediate initialiser must be initialised to 0 by the system before program startup. In practice, all such statics/globals, along with those that are explicitly initialised to 0, are placed in a .bss (possibly also .sbss for "small" items - long story) section by the linker, and so do not occupy space in the binary, but the loader will allocate space for it, and clear it to 0.

Jifl
--
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]