home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!mcsun!Germany.EU.net!ira.uka.de!chx400!bernina!bernina!neeri
- From: neeri@iis.ethz.ch (Matthias Neeracher)
- Subject: Re: incrementation differences/THINK C 4.0 vs. 5.0
- In-Reply-To: mxmora@unix.SRI.COM's message of 25 Aug 92 16:26:29 GMT
- Message-ID: <NEERI.92Aug26155235@iis.ethz.ch>
- Sender: news@bernina.ethz.ch (USENET News System)
- Organization: Integrated Systems Laboratory, ETH, Zurich
- References: <1992Aug24.223423.24473@kronos.arc.nasa.gov>
- <1992Aug24.232700.7896@Csli.Stanford.EDU> <BtIJq6.3yw@taligent.com>
- <38119@unix.SRI.COM>
- Date: Wed, 26 Aug 1992 14:52:35 GMT
- Lines: 58
-
- In article <38119@unix.SRI.COM> mxmora@unix.SRI.COM (Matt Mora) writes:
- >In article <BtIJq6.3yw@taligent.com> keith@taligent.com (Keith Rollin) writes:
- >>
- >>I don't think that's a valid assumption. Although it might be disconcerting, I
- >>don't think there's anything preventing a compiler from evaluating your sample
- >>line one way during one compile, and the very same compiler evaluating it a
- >>different way during a subsequent compile. ANSI spec section 3.3.16 says "The
- >>order of evaluation of the operands is unspecified."
- >
- >Don't you just love C! All the cool things that you can do are the very
- >same things you have to worry about. Pretty soon you'll be writing code like
- >this just to be safe. i = i + 1; :-)
-
- No. ++i is perfectly specified.
-
- >Why can't there be a smart compiler?
-
- A smart compiler works best if it has some degree of freedom, and that's
- exactly why order of evaluation is unspecified.
-
- >When a compiler doesn't know the best way to go why doesn't it just ask?
-
- Because I don't want to come back from a coffee break and have the compiler
- wait for an answer.
-
- >"not sure how you want the order of evaluation of this line:"
- > lab[i] = temp[i++]; //****THIS IS THE PROBLEM
-
- Personally, I'd prefer a B&D approach:
-
- "Order of evaluation undefined; I'll pick a different order next time".
-
- >Also why can't the compiler say this when a ";" is missing.
- >
- >Missing an ";" at the end of this line. Should I add one?"
-
- Most compilers in fact do something almost like this: They proceed with
- parsing as if there had been an ";". You have to be aware, however, that error
- recovery is a particularly nasty problem for C parsers (too little redundancy
- in the grammar, I suspect).
-
- >"Add one and Continue" or "Cancel"
- >
- >instead of
- >
- >"Missing a ";" at the end of statement."
- >
- >and stop compiling.
-
- MPW C continues compiling instead of displaying pretty animal pictures.
-
- Matthias
-
- -----
- Matthias Neeracher neeri@iis.ethz.ch
- "You think people really worship the devil?"
- "Sure. It's the perfect religion--you fuck up, you go to heaven"
- -- Andrew Vachss, _Sacrifice_
-