lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [task #7054] Clarification needed for variable initializati


From: Jonathan Larmour
Subject: [lwip-devel] [task #7054] Clarification needed for variable initialization
Date: Mon, 30 Jul 2007 21:29:17 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070530 Fedora/1.5.0.12-1.fc5 Firefox/1.5.0.12

Follow-up Comment #14, task #7054 (project lwip):

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.

At the same time, there is almost certainly no harm in explicit zero
initialisation. Compilers should still put these in the BSS, rather than the
initialised data section. But there's no standard governing this - in practice
it's most likely though.

Re comment #5, it is still better to initialise socksem and selectsem to
SYS_SEM_NULL at the time they are declared - that way the loader initialises
it along with other initialised data, which means less code.

Personally, I wouldn't support broken compilers.

But we should still remove all the places that a _init() function sets a
static/global to 0. e.g. mem_init, and I'm sure others.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?7054>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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