I accidentally typed "i =+ 1;" and the compiler did not complain!!!

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

The code built/linked without errors or warnings.  This is a major compiler issue in my opinion.  I was shocked.  What exactly got built?

Of course we all know that the correct C for is "i += 1;"

I used WICED Smart SDK 2.2.0 for the 20736S device, on a Mac OS X.

Thanks,

Gil

0 Likes
1 Solution
Anonymous
Not applicable

Hi Gil,

"i =+ 1;" is valid C syntax. What is does it it assigns the variable i to a value of +1, or just 1. This is why the compiler wouldn't recognize it as an error.

View solution in original post

2 Replies
Anonymous
Not applicable

Hi Gil,

"i =+ 1;" is valid C syntax. What is does it it assigns the variable i to a value of +1, or just 1. This is why the compiler wouldn't recognize it as an error.

Anonymous
Not applicable

Yep. You're right.  Thanks!

0 Likes