I"m using Arduino IDE 1.8.9, Compiler warning: None
I mistakenly coded
if (Snerd) {
....
}
int Snerd() {
// do stuff and return true or false
}
and the code compiled OK and the code within the IF never executed.
This probably would have thrown a warning or error if I had my preferences set accordingly but it compiled and ran. When it ran it apparently took 'if (Snerd)' as false. Obviously I should have coded 'if (Snerd())' and I eventually caught this mistake.
But if I had coded
if (notdefined) {
...
}
The compiler would have (and does) flag it as an error.
Any idea what the compiler thought it was doing when it let my original code compile and run?
C:\Users\Jim\Desktop\Clue\sketch_apr11a\sketch_apr11a.ino: In function 'void setup()':
C:\Users\Jim\Desktop\Clue\sketch_apr11a\sketch_apr11a.ino:3:8: warning: the address of 'void loop()' will never be NULL [-Waddress]
if(loop) {
^
It makes even more sense since after I changed my preference to Compiler Warning: Default, it still didn't flag it as an error. Now I understand that it isn't an error (at least as the compiler sees things).