This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Initialising an union


Aurel Balmosan <ab@orga.com> writes:

> As it is defined in ANSI-C a struct where only the first part is initialised
> is filled with zero's.

> This is defined in the ANSI-C  Language Reference A.8.7:

> Contains the initializer-list less initializer then the structure component
> has the rest values will be set to zero. There must not be more initializer
> than values in a structure component.

Does it apply to local non-static variables?  I'm pretty sure this is
true for variables in static storage, but how about local ones?
Unfortunately, I don't have access to the ANSI-C Standard :-(

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]