c++ - Shouldn't be this "=+" a syntax error? -


recently trying use following code:

int number = 4; number += other_variable;//2 ... printf("number:%d\n",number);//-->6 

but had error typing , instead i've got code:

int number = 4; number =+ other_variable;//2 ... printf("number:%d\n",number);//-->2 

apparently compiled gcc 4.7.3 , gcc 4.4.3 , result normal assignment operator. question is: shouldn't syntax error?

no - being parsed as:

number = +other_variable; 

i.e. have assignment , unary + operator. you're reading =+ it's 2 separate operators, = , +.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -