Evaluation of if's

Tim McDaniel mcdaniel at adi.com
Thu Jun 6 00:03:31 AEST 1991


About "if ( (i=1) == (i=2) )":

bard at cutter.ssd.loral.com (J H Woodyatt) writes:

   What fringy kinds of things in a standard can one expect compilers
   to sometimes overlook and thus be classifiable in the category of
   `Bad Programming Practice.'

Mr. Woodyatt should be more concerned about what HE overlooked:

   In article <1991Jun4.233928.5185 at athena.mit.edu>, scs at adam.mit.edu
   (Steve Summit) writes: 
   |> The comp.lang.c frequently-asked questions list has a bit to say
   |> about undefined order of evaluation.  Did you check it first?

Frequently-Asked Questions section 3, "Order of Evaluation", questions
25 and 26.  E-mail me for a copy if it has expired on your system.
K&R discuss the subject in section 2.12, "Precedence and Order of
Evaluation", pp. 52-54; also A7, "Expressions", paragraph 2, p. 200.
(2nd edition, 1st printing.)  Look for "side effects" in the index.
Also see "C Traps and Pitfalls", by Andrew Koenig -- a fine book.

--
   "Of course he has a knife; he always has a knife.  We all have knives.
   It's 1183 and we're barbarians."
Tim McDaniel                 Applied Dynamics Int'l.; Ann Arbor, Michigan, USA
Internet: mcdaniel at adi.com                UUCP: {uunet,sharkey}!amara!mcdaniel



More information about the Comp.lang.c mailing list