There may be a bug lurking here. The writer may have intended to write a += 2;
In the original version of C, a += 2;
and a =+ 2;
were synonyms. If you meant a = +2;
, you had to be careful to leave a space between the =
and the +
. Same with all the other operators. a=*p;
multiplied a by p. a = *p;
de-referenced the pointer p and assigned the result to a.
Then they came to their senses, and started giving warnings for =op
where op=
was probably intended, and now no longer accept =op
at all.
But old habits die hard. An old-school C programmer might might still absent-mindedly use old-school syntax, even when writing in a language other than C.
On the other hand, the =
in int x =+ 2;
is an initialization, not an assignment, and it would be bizarre for a programmer to think in terms of incrementing a variable that is only just now being given its initial value.