cyborg5 / IRLib2

Library for receiving, decoding, and sending infrared signals using Arduino
GNU General Public License v3.0
384 stars 138 forks source link

GCC Warning ... Misleading formatting ... BUG? #103

Open henrygab opened 3 years ago

henrygab commented 3 years ago

GCC now will warn about this, preventing compilation with all warnings enabled. https://github.com/cyborg5/IRLib2/blob/514db051a5f42b693416528aea2cbb189368f05e/IRLib2/IRLibDecodeBase.cpp#L56

@cyborg5 -- Is this code intended to be:

if(interval>0) {
    LowSpace=min(LowSpace, interval);
    HiSpace=max (HiSpace, interval); 
}

It is clearly formatted to suggest the entire line is gated by the if statement. However, the current code (if formatted more commonly) resolves as:

if(interval>0) {
    LowSpace=min(LowSpace, interval);
}
HiSpace=max (HiSpace, interval); 

Thanks for helping know which code is the correct fix!

See also https://github.com/adafruit/Adafruit_CircuitPlayground/pull/63