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: Diego Novillo <dnovillo at redhat dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 26 Mar 2004 19:41:11 -0500
- Subject: RE: Question for ISO C standards gurus
- Organization: Red Hat Canada
- References: <NUTMEGkvg3yIHjPPtyl0000023f@NUTMEG.CAM.ARTIMI.COM>
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 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 "
>
So, the program below should print 5? It certainly doesn't with gcc 3.2
nor mainline:
int foo (int x)
{
return x;
}
main ()
{
int *p;
int a[2];
a[0] = 4;
a[1] = 5;
p = a;
printf ("%d\n", foo (*p++));
}
It will print 5 if I use pre-increment on 'p', which is what I would've
expected (I'm no language lawyer, though).
Diego.