Mail Archives: djgpp/1999/07/16/05:40:45
Marp wrote:
>
> Mohamed Saad <bazramit AT yahoo DOT com> wrote in message
> news:19990715204430 DOT 18320 DOT rocketmail AT web105 DOT yahoomail DOT com...
> > does djgpp continue to evaluate an expression of
> > an if statement even if the result is readily
> > available?
> > i.e. consider this...
> > if (0&&dummy1)
> > statement here;
> >
> > will it evaluate dummy1??
>
> No. As a shortcut (for speed) if the left side of the && operator is false,
> the right side won't be tested. Similarly, with the || operator, if the left
> side is true, the right side won't be tested. I think you can safely rely on
> this behavior for all C and C++ compilers, but I'm not absolutely sure of
> that.
This is the standard behavior.
--
Weiqi Gao
weiqigao AT a DOT crl DOT com
- Raw text -