While reading the example code provided by Texas Instruments for their SensorTag I came across the following snippet.
void SensorTagIO_processCharChangeEvt(uint8
In MSVC converting an integer to a bool
implicitly in an if
statement can generate a warning. Doing so via !!
does not. Similar warning may exist in other compilers.
So supposing the code was compiled with that warning enabled, and a decision to treat all warning as errors, using !!
is a short and portable way to say "yes, I want this integer to be a bool
".