public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20181] New: Increment/decrement
@ 2005-02-24 8:44 d_picco at hotmail dot com
2005-02-24 9:24 ` [Bug c/20181] Increment/decrement d_picco at hotmail dot com
2005-02-24 9:25 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: d_picco at hotmail dot com @ 2005-02-24 8:44 UTC (permalink / raw)
To: gcc-bugs
Consider these situations:
int a = 0;
int b = a++ + a++;
int c = (a++) + (a++);
int d = a++ + (a++);
int e = (a++) + a++;
b == c == d == e == 0. I understand based on a previous bug about sequence
points in C++ but I think a common-sense approach takes precident here. If 'a'
were a user-defined class with the operator++ (postfix), how could the user
mimic such behaviour, namely b == c == d == e == 0? In fact they couldn't. The
proper solution is then to have b == c == d == e == 1.
--
Summary: Increment/decrement
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: d_picco at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20181
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/20181] Increment/decrement
2005-02-24 8:44 [Bug c/20181] New: Increment/decrement d_picco at hotmail dot com
@ 2005-02-24 9:24 ` d_picco at hotmail dot com
2005-02-24 9:25 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: d_picco at hotmail dot com @ 2005-02-24 9:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From d_picco at hotmail dot com 2005-02-23 20:24 -------
(In reply to comment #0)
> Consider these situations:
>
> int a = 0;
> int b = a++ + a++;
> int c = (a++) + (a++);
> int d = a++ + (a++);
> int e = (a++) + a++;
>
> b == c == d == e == 0. I understand based on a previous bug about sequence
> points in C++ but I think a common-sense approach takes precident here. If 'a'
> were a user-defined class with the operator++ (postfix), how could the user
> mimic such behaviour, namely b == c == d == e == 0? In fact they couldn't. The
> proper solution is then to have b == c == d == e == 1.
I should have clarified this more:
Consider these situations:
Case 1
======
int a = 0;
int b = a++ + a++
Case 2
======
int a = 0;
int c = (a++) + a++;
Case 3
======
... etc
Otherwise b != c != d != e if the situations were read sequentially
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20181
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/20181] Increment/decrement
2005-02-24 8:44 [Bug c/20181] New: Increment/decrement d_picco at hotmail dot com
2005-02-24 9:24 ` [Bug c/20181] Increment/decrement d_picco at hotmail dot com
@ 2005-02-24 9:25 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-24 9:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-23 20:26 -------
*** This bug has been marked as a duplicate of 11751 ***
*** This bug has been marked as a duplicate of 11751 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20181
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-02-23 20:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-24 8:44 [Bug c/20181] New: Increment/decrement d_picco at hotmail dot com
2005-02-24 9:24 ` [Bug c/20181] Increment/decrement d_picco at hotmail dot com
2005-02-24 9:25 ` pinskia at gcc dot gnu dot org
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).