🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4423

Re: On sequence points and evaluation order

#4423
From: Mark Brader
Date: Wed, 06 Dec 1995 00:16
35 lines
1915 bytes
> This point has been debated before.  Some people think the standard
> says `f()+f()' has undefined behavior when f has side effects
> (e.g. if f is defined by `int f() { static int i; return i++; }').
> Other people think the standard defines behavior for `f()+f()'.
> ... 
> It is clearly an unnecessarily messy area in the C Standard.

On the contrary, the problem is that some people (i.e. the first group
above) insist on reading the completly un-messy sentence (in 6.6/3.6,
semantics):

#  Except as indicated, statements are executed in sequence.

as if there was something in the standard$ that indicated that statements
could be interleaved.
 
> I don't know if the ISO C committee has issued an official ruling on this.

We can expect one soon, as part of the package of Record of Response 2
and Technical Corrigendum 2.  Balloting on that should have been finished
a while ago now, but I haven't heard the results of it.

> As a practical matter, if the implementation does function inlining,
> I wouldn't rely on the behavior being well-defined here.

As a practical matter, any implementer that *I* caught not producing
the behavior I expect here could expect a bug report from me.

$ - Okay, the "as if" rule allows it, but only if you can't tell it's
    happening, so that doesn't affect the "debate".
-- 
Mark Brader, msb@sq.com | "Ah, determinism (likewise, forgetfulness) reigns."
SoftQuad Inc., Toronto  |                                      --Steve Summit

My text in this article is in the public domain.
Technical Details
Message-ID: <1995Dec6.001621.7409@sq.com>
Path: arc1-ca.pugleaf.net!nntp.coast.net!torn!sq!msb
References: <49l428$od0@bolverk.cs.cornell.edu> <49qtc0$72g@light.twinsun.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!nntp.coast.net!torn!sq!msb
From: msb@sq.com (Mark Brader)
Subject: Re: On sequence points and evaluation order
Message-ID: <1995Dec6.001621.7409@sq.com>
Organization: SoftQuad Inc., Toronto, Canada
References: <49l428$od0@bolverk.cs.cornell.edu> <49qtc0$72g@light.twinsun.com>
Date: Wed, 6 Dec 1995 00:16:21 GMT