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
Post a Comment