Initialization List order

Is there any particular consequence to initializing member variables in a different order than they were declared? My compiler warns me of this every time this happens.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
struct Thisthing{
   int I,
   bool j;
   int k;
   Thisthing();
};
//I can understand an error occurring here
Thisthing::Thisthing():
   k(I),
   I(0),
   j(false)
{}
//But what is the problem here?
Thisthing::Thisthing():
   I(0),
   j(false),
   k(I)
{}
Members are initialized in the order they are declared. Writing initializer list in random order will confuse the programmer.
Topic archived. No new replies allowed.