Re: GCC not doing the correct thing?
Re: GCC not doing the correct thing?
- Subject: Re: GCC not doing the correct thing?
- From: Cameron Hayne <email@hidden>
- Date: Mon, 11 Nov 2002 17:31:30 -0500
On 9/11/02 4:35 pm, "Domain Administrators" <email@hidden> wrote:
>
Forgive me for my impertinence, but if the example code were to be
>
"undefined" by definition we would all be in a lot of trouble.
Since this point seems to need a lot of emphasis, allow me to essentially
repeat what Clark Cox has said:
The C++ standard says that the order of evaluation of sub-parts of an
expression is undefined unless explicitly mentioned. And the section on
multiplication does not define the order of evaluation of the left and
right-hand operands in a multiplication. Same thing for addition, etc.
Hence the value of (*ptr++) * (*ptr++) is undefined since it depends on the
order of evaluation of the two multiplicands.
Some people seem to think that the "left-associativity" of multiplication
means that the left operand gets evaluated before the right one. It doesn't
mean that - it merely means that x*y*z is to be evaluated as (x*y)*z. It
says nothing about the order of evaluation of the values x,y,z.
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.