delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/15/02:38:09

From: Charles Krug <charles AT pentek DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q] expression evaluation order
Date: Mon, 11 Aug 1997 09:05:19 +0100
Lines: 49
Message-ID: <33EEC7BF.1570@pentek.com>
References: <5sbb1h$kvr$1 AT newton DOT pacific DOT net DOT sg> <5sd0pd$k66$1 AT gte1 DOT gte DOT net> <33EA9D38 DOT 31561027 AT alcyone DOT com> <5sfpqj$rdk$1 AT gte2 DOT gte DOT net> <33EBB438 DOT 32888436 AT alcyone DOT com>
NNTP-Posting-Host: mail.pentek.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Erik Max Francis wrote:
> 
> 
> These compilers didn't even conform to traditional C, then.
> 
> --
The original question that started this round:

if (first() && second() && third())
	(etc)


How critical is your application, and how much interaction is there
between the functions in question?

Of course, I live a rather charmed existence.  I've never had to read
the 30 page section of a compiler manuel listing, "Differences from
Traditional C", "Differences from ANSI C", and "Differences from K&R
C."  Yep, since ANSI says it. It must be so.

I, for one, am glad that I live here in NJ, USA, where cocaine is
illegal.  I can sleep soundly knowing that no one is using illegal drugs
in my neighborhood, since they've been banned.  Yep.  Really makes me
feel secure, being free from crack heads.

On the other hand, I could test my application, using my data, on my
platform, and see what the results are.  This enables me to do two
things:

1.  Get my project done on time and under budget.

2.  Get my users (who also need to write code) up to speed on the quirks
of the compiler so they can get their work done on time and under
budget.

Broken && || evaluation isn't something you'd catch every time, unlike,
say, the increment operator.  How often do we write logicals that rely
on complex function interactions, rather than something that works out
to:

if ((a==1) && (b==1) && (c==1))

If that works correctly, as it likely does, it might not occur to most
of us to look for trouble in the evaluation of the more complex case,
given in the original post.


-- 
Charles Krug, Jr.

- Raw text -


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