jung6717 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

IDE Error Check For == vs. = in logic compare statements #218

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The IDE does not notice the difference between:

if (x=1) 

and the correct

if (x==1)

Just an enhancement.

Thanks.

Original issue reported on code.google.com by itstheme...@gmail.com on 10 Mar 2010 at 2:48

GoogleCodeExporter commented 8 years ago
Right, no compiler does this.

The compiler the IDE uses would put out a warning (I think) if it weren't 
called with
option -w which supresses warnings.

This is one of the things you always have to lookout for as a programmer.

It is not a bug that could be fixed in the Arduino-code.
Eberhard

Original comment by e.fa...@wayoda.org on 10 Mar 2010 at 3:30

GoogleCodeExporter commented 8 years ago
Yeah, this is completely valid code, though it is rarely (if ever) what the 
coder
intended.

A workaround (other than providing a place for warnings to go, so we can 
leverage the
intelligence of the compiler or preprocessor) would be to leverage the GUI code
highlighter to make this a special case.

I can see an argument for making this one of those places in the GUI where we 
warn
you you are doing something you probably don't want to do.  Given the target 
audience
of the GUI, anyway.

Original comment by clvrm...@gmail.com on 10 Mar 2010 at 5:18

GoogleCodeExporter commented 8 years ago

Original comment by federico...@gmail.com on 1 Jul 2015 at 7:57