On 02/02/2013 05:26 PM, Michael Deutschmann wrote:
On Sat, 2 Feb 2013, "Anthony G. Basile" wrote:
Even though 'value' is declared static it is never initialized.  Isn't
this a problem?

In C, statics are implicitly initialized to all-bits-zero.


After some digging around, I found this too. Since I've never programmed this way, I just assumed it was the same as non-static.

While I only know this offhand to be standards-required for static data
declared at toplevel, there's no way under the Unix assembler/linker
paradigm to specify that a non-stack variable is truly uninitialized.

Adding a '= 0;' might be a style recommendation.  However, in past people
often avoided that due to lazy compilers that would then put the object in
the data section, wasting space in the final executable file.

I also understand at one point GCC was deliberately so stupid in order to
accomodate a common hack to do what, today, we do with the "_edata"
linker-generated symbol.  Current GCC seems to be smart, though.

---- Michael Deutschmann <[email protected]>
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc



--
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to