[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-devel] [task #7054] Clarification needed for variableinitializ
From: |
Julian Gardner [RSD] |
Subject: |
RE: [lwip-devel] [task #7054] Clarification needed for variableinitialization |
Date: |
Wed, 4 Jul 2007 08:04:35 +0100 |
Well when i start using any code i remove all 0 initialisation code, so this
forces the compiler to stick the variable in the BSS section.
This is the way it should work, i think setting a variable to 0 is by default
the norm.
As to the tcp_backoff this will make the code larger as if taking the
tcp_backoff as an example we would have 13 stores and at least 7 loads.
leave the code as is and start removing the NULL and 0 assignments for GLOBAL
variables
joolz
-----Original Message-----
From: address@hidden on behalf of Simon Goldschmidt
Sent: Tue 03/07/2007 22:55
To: Simon Goldschmidt; address@hidden
Subject: [lwip-devel] [task #7054] Clarification needed for
variableinitialization
URL:
<http://savannah.nongnu.org/task/?7054>
Summary: Clarification needed for variable initialization
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: goldsimon
Submitted on: Dienstag 03.07.2007 um 19:43
Category: None
Should Start On: Dienstag 03.07.2007 um 00:00
Should be Finished on: Dienstag 03.07.2007 um 00:00
Priority: 5 - Normal
Status: None
Privacy: Public
Percent Complete: 0%
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Effort: 0.00
_______________________________________________________
Details:
The current code mixes:
- initialization to zero for global (and global static) variables
- uninitialized static arrays (initialized to 0 by compiler/loader)
- initialization to other values for global variables
- initialization in _init() functions
I'd favour making it the same for all files:
- always initialize non-zero global variables at declaration (e.g.
tcp_backoff array)
- create define to initialize global variables to zero or not (decides which
section they are put into and if they take place in the binary before
execution) (e.g. 'struct tcp_pcb *tcp_tw_pcbs INIT_NULL;' and '#define
INIT_NULL = 0' or '#define INIT_NULL') (there is a downside for arrays, so
arrays that should be zeroed - like sockets[NUM_SOCKETS] - would have to be
memset to NULL in an init function)
- generally don't zero variables in init functions that are already zeroed on
declaration
Any comments or preferences?
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/task/?7054>
_______________________________________________
Nachricht geschickt von/durch Savannah
http://savannah.nongnu.org/
_______________________________________________
lwip-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-devel
<<winmail.dat>>
- [lwip-devel] [task #7054] Clarification needed for variable initialization, Simon Goldschmidt, 2007/07/03
- RE: [lwip-devel] [task #7054] Clarification needed for variableinitialization,
Julian Gardner [RSD] <=
- [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, 2007/07/04