Newsgroups: comp.sys.sgi Path: utzoo!utgpu!news-server.csri.toronto.edu!helios.physics.utoronto.ca!aurora.physics.utoronto.ca!sysmark From: sysmark@aurora.physics.utoronto.ca (Mark Bartelt) Subject: Re: C compiler weirdness? Message-ID: <1991Apr13.001856.9496@helios.physics.utoronto.ca> Sender: news@helios.physics.utoronto.ca (News Administrator) Nntp-Posting-Host: aurora.physics.utoronto.ca Reply-To: mark@cita.toronto.edu Organization: University of Toronto Physics/Astronomy/CITA References: <4597.on.Mon,.8.Apr.91.18:32:50.EDT.@sct60a.sunyct.edu> <1991Apr12.175909.5194@helios.physics.utoronto.ca> <97139@sgi.sgi.com> Date: Sat, 13 Apr 1991 00:18:56 GMT In article <97139@sgi.sgi.com> davea@quasar.UUCP (David B.Anderson) writes: | Since Mark Bartelt claims that the compiler is wrong, I'll step up to its | defense (I do not claim that the compiler version used is ANSI C): | | ANSI C: 3.3.2.2, page 42. line 20. | ``The order of evaluation of the function designator, the arguments, | and subexpressions within the arguments is unspecified, but there is | a sequence point before the actual call.'' | | The Standard does not say whether the sequence point is before or | after the evaluation of the function designator. | | The following is thus _a_ legal sequence: | evaluate arguments (none in the case above) | sequence point (arguments evalation complete) | evaluate function designator | call function | increment pc | statement sequence point | | So IMO our code generation is legal in this case. (case dismissed :-) Hmm... Interesting interpretation. But ... I *think* (and though I feel reasonably proficient in C, I nonetheless lay no claim to being in a class with, say, Henry Spencer, let alone dmr or bwk) that in this case the | evaluate function designator *includes* the incrementing of pc. Observe that the sequence note the value of the operand increment the operand is, in its entirety, part of the semantics of the postfix ++ operator. At least, that's *my* interpretation of what the standard says. Maybe we should cross-post this to comp.lang.c (which would generate all sorts of comments, most of them bogus), or forward the discussion to dmr and bwk, and see whether either of them care to provide a definitive answer. Mark Bartelt 416/978-5619 Canadian Institute for mark@cita.toronto.edu Theoretical Astrophysics mark@cita.utoronto.ca