(C question) (s - out.s) + func(&out) -> ?

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Thu Oct 31 18:40:27 UTC 2013


On Thu, Oct 31, 2013 at 09:45:12AM -0400, Bob Copeland wrote:
> On Wed, Oct 30, 2013 at 11:50 PM, William Park <opengeometry-FFYn/CNdgSA at public.gmane.org> wrote:
> >     s = (s - out.s) + func (&out);
> >
> > However, gcc is doing
> >     s = func (&out) + (s - out.s);
> 
> This may shed some light:
> 
> http://en.wikipedia.org/wiki/Sequence_point
> 
> That is: order of operations won't necessarily determine the order in
> which the arguments are themselves evaluated, since the arithmetic
> operators do not imply a sequence point.

Yeah.  I was confusing "order of precedence" with "sequence point".
But, still, "left-to-right" evalution should mean what it says! :-)
-- 
William
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list