lwIP - A Lightweight TCP/IP stack - Tasks: task #7054, Clarification needed for variable...
You are not allowed to post comments on this tracker with your current authentication level.
task #7054: Clarification needed for variable initialization
Submitter: | Simon Goldschmidt <goldsimon> | ||
Submitted: | Tue 03 Jul 2007 07:43:45 PM UTC | ||
Category: | None | Should Start On: | Tue 03 Jul 2007 12:00:00 AM UTC |
Should be Finished on: | Tue 03 Jul 2007 12:00:00 AM UTC | Priority: | 3 - Low |
Status: | Done | Privacy: | Public |
Assigned to: | goldsimon | Percent Complete: | 100% |
Open/Closed: | Closed | Planned Release: | None |
Effort: | 0.00 |
Jump to the original submission
Tue 09 Oct 2007 08:01:06 PM UTC, comment #25: |
Simon Goldschmidt <goldsimon> |
Tue 09 Oct 2007 07:44:28 PM UTC, comment #24: OK, I'll do it, then! |
Simon Goldschmidt <goldsimon> |
Sat 06 Oct 2007 12:07:17 PM UTC, comment #23:
|
Simon Goldschmidt <goldsimon> |
Fri 05 Oct 2007 03:40:10 PM UTC, comment #22: About the patch:
|
Frédéric Bernon <fbernon> |
Thu 04 Oct 2007 07:07:18 PM UTC, comment #21: I've put together a patch that removes the need for nearly all _init() functions (since they all have set values to zero/NULL that are set by the compiler already.
|
Simon Goldschmidt <goldsimon> |
Fri 24 Aug 2007 04:05:15 PM UTC, comment #20: I was being more general to any _init routine. For example, say one wants to start/stop dhcp. (I have not looked at the dhcp code, I am just giving a example of something that you may want to start/stop)
|
Bill Florac <bflorac> |
Fri 24 Aug 2007 03:44:43 PM UTC, comment #19: Why? Why would you need to stop and restart the whole stack? This is a very improbable thing for an embedded device to do. 99% of people wouldn't need it - once the stack is going they leave it. If they really must stop the stack, then they can bring down the interfaces. They shouldn't try and call the stack init functions to get it going again.
|
Jonathan Larmour <jifl> |
Fri 24 Aug 2007 03:32:43 PM UTC, comment #18: If we rely on the compiler, than we need to make sure that on any processes that can stopped and restarted, any initializing needed to restart is done in the _start routine. Calling _init will not put everything thing back to "startup" values.
|
Bill Florac <bflorac> |
Fri 24 Aug 2007 02:45:01 PM UTC, comment #17: I'd agree with the consensus that seems to have been reached here, i.e. we can assume that a compiler will initialise static variables and globals to zero, and so INIT_NULL/ZERO should not be necessary, nor should it be necessary to later set them to zero in an _init function.
|
Kieran Mansley <kieranm> |
Tue 31 Jul 2007 12:26:05 AM UTC, comment #16: Ah yes Frédéric, good point! |
Jonathan Larmour <jifl> |
Mon 30 Jul 2007 10:29:52 PM UTC, comment #15:
|
Frédéric Bernon <fbernon> |
Mon 30 Jul 2007 09:29:17 PM UTC, comment #14: I'm with David Empson. Compilers/linkers have zero initialised statics and globals to 0 since the days of K&R C, the ANSI C/ISO C standards of 1989/1990 made it concrete. We really shouldn't need to worry about that any more. It's more likely that someone (maybe the user, not the compiler or OS writers) has a bug in their linker script.
|
Jonathan Larmour <jifl> |
Thu 05 Jul 2007 11:57:35 PM UTC, comment #13: ISO/IEC C99 support is patchy at present. None of the embedded compilers I use are anywhere near being compliant with it.
|
David Empson <dempson> |
Thu 05 Jul 2007 04:54:56 PM UTC, comment #12: I didn't have participate to bug #20254. But like I say in comment #10, if we don't support "broken" compilers, so, we don't have to support gcc !!! (and of course, it could seems crazy to do that).
|
Frédéric Bernon <fbernon> |
Thu 05 Jul 2007 04:43:12 PM UTC, comment #11: Hmmm, now that I know it's in the standard, it would indeed be coding around broken compilers, and I thought we had decided not to do that in bug #20254? |
Simon Goldschmidt <goldsimon> |
Thu 05 Jul 2007 07:19:48 AM UTC, comment #10: But even like this, I think the INIT_NULL solution is not so bad, since we only use it on "some" variables.
|
Frédéric Bernon <fbernon> |
Thu 05 Jul 2007 07:09:52 AM UTC, comment #9: Same thing in recent relase "ISO/IEC 9899:1999 - Programming languages - C" from JTC 1/SC 22/WG 14 :
|
Frédéric Bernon <fbernon> |
Thu 05 Jul 2007 06:49:09 AM UTC, comment #8: Yes, I am blind. Thanks for clarification! |
Simon Goldschmidt <goldsimon> |
Thu 05 Jul 2007 03:48:01 AM UTC, comment #7: In e-mail discussion on lwip-devel (outside the bug tracker), Simon Goldschmidt wrote:
|
David Empson <dempson> |
Wed 04 Jul 2007 02:42:38 PM UTC, comment #6: http://savannah.nongnu.org/bugs/?20254
|
Frédéric Bernon <fbernon> |
Wed 04 Jul 2007 09:38:03 AM UTC, comment #5: Some problem with some init. In sockets.c file, you could see :
|
Frédéric Bernon <fbernon> |
Wed 04 Jul 2007 08:09:01 AM UTC, comment #4: ("The C Programming Language" by Kernighan & Ritchie)
|
Frédéric Bernon <fbernon> |
Wed 04 Jul 2007 07:58:20 AM UTC, comment #3: In "The C Programming Language" by Kernighan & Ritchie, we can read "External and static variables are initialized to zero by default." Of course, you need to have a ANSI C compiler to be sure of that.
|
Frédéric Bernon <fbernon> |
Wed 04 Jul 2007 07:38:29 AM UTC, comment #2:
|
Simon Goldschmidt <goldsimon> |
Wed 04 Jul 2007 07:30:57 AM UTC, comment #1: (Julian Gardner wrote)
|
Frédéric Bernon <fbernon> |
Tue 03 Jul 2007 07:43:45 PM UTC, original submission:
The current code mixes:
|
Simon Goldschmidt <goldsimon> |
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 6 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2007-10-09 | goldsimon | Status | None | Done | |
Percent Complete | 0% | 100% | |||
Open/Closed | Open | Closed | |||
2007-10-06 | goldsimon | Assigned to | None | goldsimon | |
2007-10-04 | goldsimon | Attached File | - | Added lwip_init.patch, #14083 | |
2007-07-13 | kieranm | Priority | 5 - Normal | 3 - Low |
Powered by Savane 3.13-02a9.
Corresponding source code
Checked in. Closing this as done.