This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: default-initialization (was Re: partly bracketed initializer ?)



On Feb 20, 1999, Bob McWhirter <bob@werken.com> wrote:

> On 20 Feb 1999, Alexandre Oliva wrote:
>> [dcl.init.aggr]/7 says that aggregate members that are not explicitly
>> initialized shall be default-initialized.  Default initialization for
>> scalar types is zero-initialization, so there should be no problem.

> class Foo {
> 	int i;
> }

> I've found that Foo::i isn't necessary initialized to 0.
> (even if Foo is on the stack not the heap).

Foo is not an aggregate, because it has private members, and in order
to have default-initialization of remaining members you must
have an incomplete initializer list, not an empty one.

> Is this correct behaviour?

Yep

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil