Difference between using logical not operator and comparison to (boolean) constants
This is probably a *** question, but I was wondering if there is a difference in performance between the following C statements given b is a standard boolean:
bool b = false;
//...
if (b == false)
//...
if (!b)
//...Will gcc in STM32 Cube IDE translate these to the same number of instructions? It seems the second statement would require two operations: first to negate, then to check for inequality to zero, unless the compiler knew how to optimize this. I ask because I see a lot of the first form in the HAL and LL library code, but the second form to me is simpler and quicker. I had trouble finding the answer online, as this normally would be trivial, although I could see it being something to consider at a very slow clock or in a loop. Is there an easy way to see the C code side-by-side with the assembler in cube IDE?
