ABL electronic PIC12 Personal Computer User Manual


 
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 a is false (0), then operands b and c will not be evaluated. This is very
important if b and c are expressions, as their possible side effects will not take
place!
Logical vs. Bitwise
Be aware of the principle difference between how bitwise and logical operators
work. For example:
0222222 & 0555555
/* equals 000000 */
0222222 && 0555555
/* equals 1 */
~ 0x1234
/* equals 0xEDCB */
! 0x1234
/* equals 0 */
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
10 8
MikroElektronika:
Development
tools
-
Books
-
Compilers
page