Why the following code doesn't give errors when I try to compile with gcc, and....
this one does?Code:#include <stdio.h> int x = 2; const int y = 2; switch(x) { case(y) { break; } default: break; }
error: ‘y’ cannot appear in a constant-expressionCode:#include <stdio.h> #include "remote_conf.hxx" int x = 2; auto_ptr<Remote> aXML (Remote_("../config/remote_conf.xml")); const int y =(const int)( aXML->y() ); switch(x) { case(y) { break; } default: break; }