[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [task #7054] Clarification needed for variable initializati
From: |
David Empson |
Subject: |
[lwip-devel] [task #7054] Clarification needed for variable initialization |
Date: |
Thu, 05 Jul 2007 03:48:02 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 |
Follow-up Comment #7, task #7054 (project lwip):
In e-mail discussion on lwip-devel (outside the bug tracker), Simon
Goldschmidt wrote:
> Maybe I'm blind, I didn't find it in the ANSI C standard :-(
Looking at my copy of the original ANSI C standard (1990) it is specified in
section 6.5.7 Initialization, under the Semantics sub-heading:
"If an object that has automatic storage duration is not initialized
explicitly, its value is indeterminate. If an object that has static storage
duration is not initialized explicitly, it is initialized implicitly as if
every member that has arithmetic type were assigned 0 and every member that
has pointer type were assigned null pointer constant."
i.e. it is a requirement of ANSI C. A compiler must do this if set to operate
in ANSI mode. It might decide to omit it if running in non-ANSI mode (but
should at least offer it as an option).
In my experience with embedded compilers, it is usually a function of the
startup code, and if the user has the source code to this, they could modify
it to omit clearing of uninitialized variables, e.g. for performance
reasons.
I think it is reasonable to require implicit initialization to zero of static
variables for LWIP. I'd prefer that to an ugly solution like INIT_NULL
scattered everywhere in the source code.
A user who really cares about the performance implications should do
something like arrange for the LWIP uninitialized variables to be linked in a
memory area which is cleared on startup, while their "large and speed
critical" uninitialized variables go in a separate memory area. There could
be performance issues with this scheme if LWIP has a lot of large static
variables.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/task/?7054>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- RE: [lwip-devel] [task #7054] Clarification needed for variableinitialization, (continued)
- RE: [lwip-devel] [task #7054] Clarification needed for variableinitialization, Julian Gardner [RSD], 2007/07/04
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/04
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Simon Goldschmidt, 2007/07/04
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/04
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/04
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/04
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/04
- RE: [lwip-devel] [task #7054] Clarification needed for variable initialization, Goldschmidt Simon, 2007/07/04
- [lwip-devel] [task #7054] Clarification needed for variable initialization,
David Empson <=
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Simon Goldschmidt, 2007/07/05
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/05
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/05
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Simon Goldschmidt, 2007/07/05
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/05
- [lwip-devel] [task #7054] Clarification needed for variable initialization, David Empson, 2007/07/05
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Kieran Mansley, 2007/07/13
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Jonathan Larmour, 2007/07/30
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Frédéric Bernon, 2007/07/30
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Jonathan Larmour, 2007/07/30