I suggest disassembling the code and looking at the code generated by the
compiler. Nothing like looking at what the CPU actually gets!

I'm by no means a C expert, but if I recall correctly, C always short
circuits such things, applying the conditions in order from left to right,
and stopping as soon as the overall result of the if condition is known.
Therefore, your first sample will evaluate (y | 0x3f) first, while your
second sample will (obviously) evaluate (x) first. Switching around the
order of the arguments to the && operator, as you suggest, will cause (x) to
be evaluated first, and therefore should produce identical code to your
second sample.

Check the disassembly and see if I'm right. If you're using CodeWarrior, you
can disassemble any source file in the project by choosing Disassemble from
the Project menu. Another way to look at the assembly language code is with
PalmDebugger.
-- 
Peter Epstein

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to