compilation error in switch case in c++



 DEVELOP > c-Plus-Plus > compilation error in switch case in c++

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1
Topic: DEVELOP > c-Plus-Plus
User: "Rahul"
Date: 06 Feb 2008 03:15:14 AM
Object: compilation error in switch case in c++
Hi Everyone,
I have the following program,
class A
{
int i;
};
int main()
{
switch(1)
{
case 1 :
// {
A obj;
printf("case 1\n");
// }
break;
case 2 :
A obj1;
printf("case 2\n");
break;
}
}
and when i compile, i get an compilation error, saying,
jump to case symbol
enters scope of non-POD 'A obj'
but if i remove the commented open and close brace, it works just
fine, could anyone clarify the exact reason of the compiler reporting
the error,
Thanks in advance!!!
.


  Page 1 of 1


 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER