[hatari-devel] Debugger crash changes / zeroing global variables

Eero Tamminen oak at helsinkinet.fi
Sat Jan 14 16:53:46 CET 2012


Hi,

Nicolas, what are these changes:
http://hg.tuxfamily.org/mercurialroot/hatari/hatari/rev/5651a4bfdf0e
http://hg.tuxfamily.org/mercurialroot/hatari/hatari/rev/b9e92dc09385
?

Uninitialized global variables are already zero.  Or your compiler
is buggy, as C specification states that:
---------
If an object that has static storage duration is not initialized explicitly, 
then:

if it has pointer type, it is initialized to a null pointer;
if it has arithmetic type, it is initialized to (positive or unsigned) zero;
if it is an aggregate, every member is initialized (recursively) according 
to these rules;
if it is a union, the first named member is initialized (recursively) 
according to these rules.
---------

Explicitly setting global variables to NULL/zero/false, may move the
variables from (initially zeroed) BSS to DATA section and increase
the binary size minimally, it doesn't change the values of those
variables as they already were zero.  See also:
	http://en.wikipedia.org/wiki/.bss

I.e. I think there's some other problem that you just hid.


	- Eero



More information about the hatari-devel mailing list