From: law@redhat.com
To: Diego Novillo <dnovillo@redhat.com>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Question for ISO C standards gurus
Date: Sat, 27 Mar 2004 21:56:00 -0000 [thread overview]
Message-ID: <200403271424.i2REOjiD022052@speedy.slc.redhat.com> (raw)
In-Reply-To: Your message of "Fri, 26 Mar 2004 19:41:11 EST." <1080348071.4600.244.camel@localhost.localdomain>
In message <1080348071.4600.244.camel@localhost.localdomain>, Diego Novillo wri
tes:
>On Thu, 2004-03-25 at 13:08, Dave Korn wrote:
>
>> "Here is the complete list of all sequence points in C++:
>>
>> at the end of a full expression
>>
>> after the evaluation of all function arguments in a function call and befor
>e
>> execution of any expressions in the function body
>>
>> after copying of a returned value and before execution of any expressions
>> outside the function
>>
>> after evaluation of the first expression in a&&b, a||b, a?b:c, or a,b
>>
>> after the initialization of each base and member in the constructor
>> initialization list "
>>
>So, the program below should print 5? It certainly doesn't with gcc 3.2
>nor mainline:
No, it should print 4.
First you evaluate the argument to produce the passed-in value, note this
will not reflect any post side effects. Then you emit the post side effects.
This effectively means that when you have post side effects that you have
to compute the value for the argument into a temporary and use the temporary
in the function call.
The ordering of stuff for a call effectively looks like
prequeue fncall
prequeue arg0
prequeue arg1
prequeue arg2
...
prequeue argn
temp0 = arg0
temp1 = arg1
temp2 = arg2
...
tempn = argn
postqueue arg0
postqueue arg1
postqueue arg2
...
postqueue argn
fncall (temp0, temp1, temp2, ... tempn)
poster fncall
Clearly for cases where there are no postqueues for a particular argument
you need not create a temporary and instead can use the evaluated argument
directly in the call.
Jeff
next prev parent reply other threads:[~2004-03-27 14:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-25 18:47 law
2004-03-25 18:58 ` Dave Korn
2004-03-27 1:35 ` Diego Novillo
2004-03-27 11:25 ` Ian Lance Taylor
2004-03-27 14:25 ` Diego Novillo
2004-03-29 17:18 ` Dave Korn
2004-03-27 21:56 ` law [this message]
2004-03-25 18:59 ` Paul Jarc
2004-03-25 19:14 ` Dale Johannesen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200403271424.i2REOjiD022052@speedy.slc.redhat.com \
--to=law@redhat.com \
--cc=dnovillo@redhat.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).