It is not technically a boolean - it is a BOOL which is our implementation of a boolean (TRUE = 1, FALSE = 0). If we don't explicitly compare a BOOL to TRUE, compiler will consider any non-zero val...
It is not technically a boolean - it is a BOOL which is our implementation of a boolean (TRUE = 1, FALSE = 0).
If we don't explicitly compare a BOOL to TRUE, compiler will consider any non-zero value to be TRUE. So if memory is overwritten/corrupted to a random non-zero value, it would satisfy "if ( isSyringePumpPreLoaded() )" and s.w would do the wrong thing.
For extra safety, we prefer to compare to TRUE (1) or FALSE (0) depending on what would be safer.
For example, in this case we are deciding whether to seek plunger or alarm. We only seek plunger if the syringe pump was pre-loaded. It is safer to check pre-loaded flag is TRUE (1) to seek and ANY OTHER VALUE would alarm.
Also, when using the "==" compare operator, we will put the literal first. It looks awkward, but if we accidently use the "=" operator by mistake the compiler will give us a syntax error which saves us from having a tricky bug to fix later.