Re: C, standards, and depending on them

From: Daniel Kahlin (
Date: 2005-04-01 21:36:33

On Fri, 1 Apr 2005, Ullrich von Bassewitz wrote:

> On Fri, Apr 01, 2005 at 03:00:39PM +0200, Spiro Trikaliotis wrote:
>> In fact, if I really rely on this behaviour (variables being
>> initialized), I find it much better if I make this assumption explicit
>> by writing the "= 0" after the definition of the variable. It does not
>> harm and (hopefully) tells the programmer after me that this was done
>> deliberately.
> Well actually it does. Usually, initialized variables won't go into the bss
> segment (even if they're zero), so the resulting executable gets bigger. This
> can be an issue on small platforms, or on platforms with slow disk I/O (the
> 1541 comes to mind).

I don't think the standard specifies that initialized variables should go 
to the data segment instead of bss.   Infact, gcc 3.3.1 and up will 
optimize '0'-initialized data into bss unless -fno-zero-initialized-in-bss 
is explicitly specified.


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.