Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: Short circuit evaluation/expression rearrangement (2nd summary)
Message-ID: <1991Jun3.222214.20948@zoo.toronto.edu>
Date: Mon, 3 Jun 1991 22:22:14 GMT
References: <1991May27.113628.26880@ucthpx.uct.ac.za> <16283@smoke.brl.mil> <andand.675959815@cia.docs.uu.se>
Organization: U of Toronto Zoology

In article <andand.675959815@cia.docs.uu.se> andand@cia.docs.uu.se (Anders Andersson) writes:
> [a + b + c]
>What you DO know:     The addition of a and b will be made before c is
>                       added to the result.

More precisely, what you know is that the program will *behave as if* things
were done that way.  In particular, if the compiler can be sure that the
order of evaluation will not affect behavior, it can use any order it pleases.
For example, if the implementation ignores integer overflows, the additions
in a+b+c+d can be done in any order.
-- 
"We're thinking about upgrading from    | Henry Spencer @ U of Toronto Zoology
SunOS 4.1.1 to SunOS 3.5."              |  henry@zoo.toronto.edu  utzoo!henry
