mikroC - C Compiler for Microchip PIC microcontrollers
Logical Expressions and Side Effects
General rule with complex logical expressions is that the evaluation of consecutive
logical operands stops the very moment the final result is known. For example, if
we have an expression:
a && b && c
where
important if
place!
Logical vs. Bitwise
Be aware of the principle difference between how bitwise and logical operators
work. For example:
0222222 &
0222222 && 0555555
~ 0x1234
! 0x1234
page
108
is false (0), then operands
a
and
are expressions, as their possible side effects will not take
b
c
0555555
MikroElektronika: Development tools - Books - Compilers
and
will not be evaluated. This is very
b
c
/* equals 000000 */
/* equals 1 */
/* equals 0xEDCB */
/* equals 0 */
mikroC
making it simple...
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?