T
Thomas Heinz
Hi
Consider the following program.
class T
{
int b, a;
T(int a, int b) : a(a), b(b) {}
};
g++ -Wall -c test.cc produces the following warning.
test.cc: In constructor `T::T(int, int)':
test.cc:3: Warnung: `T::a' will be initialized after
test.cc:3: Warnung: `int T::b'
test.cc:4: Warnung: when initialized here
Obviously, g++ likes the initialization order to be
the same as the declaration order of the corresponding
variables. Does anyone know whether/why it is critical
for them to have the same order?
Thanks for your help.
Regards,
Thomas
Consider the following program.
class T
{
int b, a;
T(int a, int b) : a(a), b(b) {}
};
g++ -Wall -c test.cc produces the following warning.
test.cc: In constructor `T::T(int, int)':
test.cc:3: Warnung: `T::a' will be initialized after
test.cc:3: Warnung: `int T::b'
test.cc:4: Warnung: when initialized here
Obviously, g++ likes the initialization order to be
the same as the declaration order of the corresponding
variables. Does anyone know whether/why it is critical
for them to have the same order?
Thanks for your help.
Regards,
Thomas