Post Reply 
C Evaluation
07-16-2022, 05:02 PM (This post was last modified: 07-16-2022 05:02 PM by ijabbott.)
Post: #6
RE: C Evaluation
(07-15-2022 11:20 PM)KeithB Wrote:  If expression does guarantee left to right evaluation and short-circuiting so that you can do something like:
if (p && (p->status == 0))

so that p->status is not evaluated if p is NULL.

It's the && and || operators that guarantee left to right evaluation and short-circuiting. The `if` only cares whether the expression compares equal to 0 or not.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
C Evaluation - toml_12953 - 07-14-2022, 08:06 PM
RE: C Evaluation - Craig Bladow - 07-14-2022, 08:34 PM
RE: C Evaluation - cruff - 07-14-2022, 11:44 PM
RE: C Evaluation - Sylvain Cote - 07-15-2022, 01:12 AM
RE: C Evaluation - KeithB - 07-15-2022, 11:20 PM
RE: C Evaluation - ijabbott - 07-16-2022 05:02 PM
RE: C Evaluation - robve - 07-16-2022, 06:43 PM



User(s) browsing this thread: 1 Guest(s)