This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Question for ISO C standards gurus
- From: "Dave Korn" <dk at artimi dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 25 Mar 2004 18:08:48 -0000
- Subject: RE: Question for ISO C standards gurus
> -----Original Message-----
> From: gcc-owner On Behalf Of law@redhat.com
> Sent: 25 March 2004 18:03
> Given something like this:
>
>
> execfuncdef(Estate state, int do_exec)
> {
> Shfunc shf;
> char *s;
> int signum, nprg, sbeg, nstrs, npats, len, plen, i, htok = 0;
> Wordcode beg = state->pc, end;
> Eprog prog;
> Patprog *pp;
> LinkList names;
> end = beg + ((state->pc[-1]) >> 5);
> if (!(names = ecgetlist(state, *state->pc++, 2, &htok))) {
> state->pc = end;
> return 0;
> }
> }
>
>
> Does the ISO standard say anything about when the side effect
> of incrementing
> state->pc takes effect? Or is it implementation dependent? Of
> state->particular
> interest is whether or not the increment occurs before the
> call or after the call.
>
> jeff
Isn't there a sequence point in between evaluating function args and
actually doing the function call that will force the side-effects to have
been applied?
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=%22sequence+point%22+
function+call+evaluate+arguments
takes me to
http://www.langer.camelot.de/Articles/VSJ/SequencePoints/SequencePoints.html
which certainly suggests so:
"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 before
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 "
cheers,
DaveK
--
Can't think of a witty .sigline today....