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.
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.
And on -that- note...
Given a class
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).
I must include a constructor:
Foo::Foo()
: i(0)
{
}
else, someFoo.i might be just an random number.
Is this correct behaviour? (Don't take this as complaint or a request
for a bug fix... just a question).
(actually, this only happens on linux. On Solaris, i -does- seem to
0-initialize).
Thanks!
-Bob
--
Bob McWhirter Shop Foreman, Decision Scientist, Cat Juggler
Werken Digital A division of the Benjamin J. Werken & Sons Company
bob@werken.com http://www.werken.com./