🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2624

Re: Function Argument Evaluation

#2624
From: Blair P. Houghton
Date: Wed, 27 Mar 1991 06:16
50 lines
2877 bytes
In article <1991Mar26.181821.22912@cs.ucla.edu> jon@maui.cs.ucla.edu (Jonathan Gingerich) writes:
>Thanks Blair,(and everyone else contributing)

You're welcome.

>your point perfectly well.  My question remains 'Does "the value
>of the left operand after the assignment" mean "immediately after" or 
>"sometime after, before the next sequence point"?'

Sequence points (q.v., if you have the Standard handy) define what
"after" is.  Machines have a tendency to have propagation delays
for register transfers and whatnot, so it's not possible for
"immediately" to exist; plus, this is a high-level language, and
it will be translated into any number of object-level representations.

"Before" an operation is a sequence point.  "After" an
operation is the next sequence point.  There is no
"after the operation but before the sequence point."

>A second question is whether the expression (print statement) is defined to
>begin with, which would render the above question meaningless, unless it
>can be reconstructed with a volitile variable.  I had thought Doug was
>claiming the statement was not undefined, but I may have misinterpreted
>his posting.

You win the Convoluted Paragraph Of The Quarter Prize.
I had to solve it to figure out what you could possibly
be saying without also being totally bats:

If you mean "is the function call guaranteed to occur
regardless of the order of evaluation of the arguments,"
then yes, that is correct.  Something will be printed,
using the format passed and to the file specified, if their
values are not somehow dependent on the order of
evaluation.  (Here they are, respectively, a string constant
(the format), and implied (stdout, the place to which
printf(3) prints), so they aren't dependent on a couple of
assignments and dereferences).  This is true of all
functions, not just predefined library routines.

To clarify: the machine _must_ evaluate the expressions and
call the function; the word "unspecified" merely says that
the Standard refuses to insist on a specific order.

If the Standard says "the behavior is undefined," then you
can start taking bets as to what will happen next.

				--Blair
				  "Code is to time what
				   topology is to geometry."
Technical Details
Message-ID: <3484@inews.intel.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!think.com!spool.mu.edu!cs.umn.edu!talon.UCS.ORST.EDU!usenet!ogicse!intelhf!ichips!iwarp.intel.com!inews!hopi!bhoughto
References: <1991Mar25.174542.24419@cs.ucla.edu> <3461@inews.intel.com> <1991Mar26.181821.22912@cs.ucla.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!think.com!spool.mu.edu!cs.umn.edu!talon.UCS.ORST.EDU!usenet!ogicse!intelhf!ichips!iwarp.intel.com!inews!hopi!bhoughto
From: bhoughto@hopi.intel.com (Blair P. Houghton)
Newsgroups: comp.std.c
Subject: Re: Function Argument Evaluation
Message-ID: <3484@inews.intel.com>
Date: 27 Mar 91 06:16:29 GMT
Article-I.D.: inews.3484
References: <1991Mar25.174542.24419@cs.ucla.edu> <3461@inews.intel.com> <1991Mar26.181821.22912@cs.ucla.edu>
Sender: news@inews.intel.com
Organization: Intel Corp, Chandler, AZ
Lines: 50