This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC's statement expression extension
- To: Anjul Srivastava <anjul dot srivastava at sanchez dot com>
- Subject: Re: GCC's statement expression extension
- From: sidster <patrick at mail dot boxsoft dot com>
- Date: Fri, 28 Jul 2000 12:44:48 -0700
- Cc: "'Linus Torvalds'" <torvalds at transmeta dot com>, Marc Espie <espie at quatramaran dot ens dot fr>, gcc at gcc dot gnu dot org
- References: <383558CE36E2D311AC790004AC33FF67616CD7@OZ>
* Anjul Srivastava (anjul.srivastava@sanchez.com) [20000728 12:13]:
> It does not have undefined behavior, and will always evaluate to: three plus
> twice the old value of i.
>
> But that's besides the point. Even if you consider: ++i + i++ the behavior
> is undefined,
>
> but it cannot format your hard disk and still remain conforming. It cannot
> ever return 42, regardless of the value of i. (It can only return an odd
> integer but this again is besides the point).
Of course it can:
i = 20;
n = ++i + i++;
// assume evaluation is from right to left
//
n = (21+1) + 20; // n = 42
Best regards,
patrick
--
We've heard that a million monkeys at a million keyboards could
produce the Complete Works of Shakespeare; now, thanks to the
Internet, we know this is not true.
-Robert Wilensky