473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Evaluation Order in a Condition statement

Hello.

Let A and B be 2 boolean expressions.
In the instruction if(A && B){/*..*/}, does the standard certify that A
will be evaluated first ?

Thanks a lot.
Mar 18 '08 #1
3 2558
On Mar 18, 3:32 pm, David Côme <davidc...@wanadoo.frwrote:
Hello.

Let A and B be 2 boolean expressions.
In the instruction if(A && B){/*..*/}, does the standard certify that A
will be evaluated first ?

Thanks a lot.
left to right
Mar 18 '08 #2
=?utf-8?Q?David_C=C3=B4me?= <da*******@wanadoo.frwrote in
news:op.t78bb5kyrttu86@debian:
Hello.

Let A and B be 2 boolean expressions.
In the instruction if(A && B){/*..*/}, does the standard certify that A
will be evaluated first ?
Even more: if A yields false, B is not evaluated at all.
Mar 18 '08 #3
On Mar 19, 7:40 am, Christopher <cp...@austin.rr.comwrote:
On Mar 18, 3:32 pm, David Côme <davidc...@wanadoo.frwrote:
Hello.
Let A and B be 2 boolean expressions.
In the instruction if(A && B){/*..*/}, does the standard certify that A
will be evaluated first ?
Thanks a lot.

left to right
This is absolutely right! Lazy evaluation!

Cheers,
Mar 19 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Bhushit Joshipura | last post by:
This post contains one question and one proposal. A. May I know why order of evaluation of arguments is not specified in C/C++? I asked a question in comp.lang.c++ for the following...
15
by: Jens.Toerring | last post by:
Hi, I have a possibly rather stupid question about the order of evaluation in a statement like this: result = foo( x ) - bar( y ); How can I make 100% sure that foo(x) is evaluated before...
21
by: dragoncoder | last post by:
Consider the following code. #include <stdio.h> int main() { int i =1; printf("%d ,%d ,%d\n",i,++i,i++); return 0; }
77
by: berns | last post by:
Hi All, A coworker and I have been debating the 'correct' expectation of evaluation for the phrase a = b = c. Two different versions of GCC ended up compiling this as b = c; a = b and the other...
10
by: nachch | last post by:
Does the C specification define the order of evaluation of assignment statements? For example, what should be the output from the following: int foo1() { printf("foo1\n"); return 0; } int...
7
by: Peter | last post by:
I know the order of construction of member and base class objects. My question is the following: Is the order of evaluation of argument lists for these constructors also defined? E.g. can I...
32
by: silpau | last post by:
hi, i am a bit confused on expression evaluation order in expressions involving unary increment.decrement operators along with binary operators. For example in the following expression x...
54
by: Rasjid | last post by:
Hello, I have just joined and this is my first post. I have never been able to resolve the issue of order of evaluation in C/C++ and the related issue of precedence of operators, use of...
33
by: Stef Mientki | last post by:
hello, I discovered that boolean evaluation in Python is done "fast" (as soon as the condition is ok, the rest of the expression is ignored). Is this standard behavior or is there a compiler...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.