On Wednesday 22 August 2001 13:21, you wrote:
>
> // begin sample one
> if((y | 0x3f) && x)
> {
> //do something
> }
> else
> {
> //do something else
> }
> // end sample one
>
> // begin sample two
> if(x)
> {
> if(y | 0x3f)
> {
> // do something
> }
> }
> else
> {
> // do something else
> }
> // end sample two
>
> Is there any difference in the speed at which the code completes if x is
> false? Will it change if the first line in sample one reads :
> if(x && (y | 0x3f) )
>
Ok Mike,
For starters, not only will they run at different speeds, they will give
different results. In the first one, if (y|0x3f) is false or if x is false,
then the else is taken. In the second one, the else is taken if and only if
the x is false. They will not give the same results, changing where the x is
checked in the if will have no effect on it.
Chris
--
[EMAIL PROTECTED]
Author of Trek 2.2 for the Palm Pilot
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/