www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/31/23:37:07

From: varobert AT colba DOT net
Message-Id: <3.0.32.19990731233613.007b0340@mail.colba.net>
X-Sender: varobert AT mail DOT colba DOT net
X-Mailer: Windows Eudora Pro Version 3.0 (32)
Date: Sat, 31 Jul 1999 23:36:14 -0400
To: djgpp AT delorie DOT com
Subject: Re: basic c question
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

It's a required C (C++ ?) behaviour. In an and statement, the first
condition is evaluated, and the second one only if the first is true. The
same hold true for OR: if the first expression is true, it won't bother to
evaluate all the others, if not, it'll go one by one from left to rigth.

At 01:18 AM 7/9/98 +0300, you wrote:
>let's say we ahve the following expresion:
>if((a)&&(b)) {}
>
>the compiler evaluates a or b first?
>and does it optimize the evaluation, so if the first of them in 0, don't
>bother about the other one?? (0&&1==0)
>
>
>

- GodOfWar
Computers are getting faster, smaller and cheaper with time. Does that mean
that Microsoft invented time travel ?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019