whats so bad about [-WReorder]?

This class gives me a warning: [-WReorder]. Its the order of the initialize list:
1
2
3
4
5
6
7
8
class foo
{
 int x;
 int y;

 public:
  foo(void) :y(0),x(0) {}
};


I'm wondering why it is a warning. I get the cause (and the solution), but I don't know why something like this is worthy of being a warning. Thanks.
gcc emits quite a few warnings about technically correct programs. In this case it is just reminding you what the order of initialization is, in case you might try to use y in the initializer of x: foo(void) : y(0), x(y) {} // x is garbage
Ah, thanks :)
Topic archived. No new replies allowed.