* About a paradox of post increment operator
@ 2007-12-10 1:13 孙宗君
2007-12-10 1:58 ` Tim Prince
0 siblings, 1 reply; 2+ messages in thread
From: 孙宗君 @ 2007-12-10 1:13 UTC (permalink / raw)
To: gcc-help
Hi, all
I am not sure whether this is a proper place to put up with my
question. But I think you can answer my question.
See following two clauses
int x=20, y=35, z;
case 1: x = x++ + y++;
case 2: z = x++ + y++;
in case 1. the result is x = 36;
in case2: the result is z = 35;
Whether this is a paradox for post increment operator ?
Look forward to your kindly answers.
Thanks very much.
BRs
Zongjun.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: About a paradox of post increment operator
2007-12-10 1:13 About a paradox of post increment operator 孙宗君
@ 2007-12-10 1:58 ` Tim Prince
0 siblings, 0 replies; 2+ messages in thread
From: Tim Prince @ 2007-12-10 1:58 UTC (permalink / raw)
To: 孙宗君; +Cc: gcc-help
åå®å wrote:
> Hi, all
>
> I am not sure whether this is a proper place to put up with my
> question. But I think you can answer my question.
>
> See following two clauses
>
> int x=20, y=35, z;
>
> case 1: x = x++ + y++;
> case 2: z = x++ + y++;
>
> in case 1. the result is x = 36;
> in case2: the result is z = 35;
>
> Whether this is a paradox for post increment operator ?
>
comp.lang.c FAQ applies. case 1 invokes Undefined Behavior. For case
2, stuff you haven't shown must be affecting your result.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-10 1:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-10 1:13 About a paradox of post increment operator 孙宗君
2007-12-10 1:58 ` Tim Prince
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).