This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GCC's statement expression extension


* 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]