Why doesn't the duplicate and semicolon at the end of the expression cause an error in the visual compiler studio?

the visual studio dose does not distinguish between a repeating semicolon or one to cause an error while compiling the code, this contradicts old compiler rules like turbo c or something else!

thats ok code

int x ;;;;;;;  

and this is also normal!

int x;
0
source share
2 answers

Additional half-columns are simply empty statements in C ++. This is not a syntax error, so it compiles fine.

Half-columns are what final statements are, so you can do things like this:

int x; int y; int z;

all in one line.

+2
source

; regarded as an EMPTY statement.

EMPTY Statement #, .

int val=40;
if(val > 100)
{
  //do something
}
else
{
 ;  //do nothing
}

MSDN:

. empty-statement:; , , . . , , .

0

All Articles