From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12105 invoked by alias); 23 Feb 2005 20:46:43 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 11994 invoked by uid 48); 23 Feb 2005 20:46:36 -0000 Date: Thu, 24 Feb 2005 10:38:00 -0000 Message-ID: <20050223204635.11993.qmail@sourceware.org> From: "d_picco at hotmail dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20030731175202.11751.me@elitsa.net> References: <20030731175202.11751.me@elitsa.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/11751] wrong evaluation order of an expression X-Bugzilla-Reason: CC X-SW-Source: 2005-02/txt/msg02891.txt.bz2 List-Id: ------- Additional Comments From d_picco at hotmail dot com 2005-02-23 20:46 ------- Here is a better clarification: Case 1 ====== int a = 0; int b = a++ + a++; printf("b = %d\n", b); // output is 0 Case 2 ====== class A { int a_; public: A() : a_(0) {} int operator++() { return a_++; } }; A a; int b = a++ + a++; printf("b = %d\n", b); // output is 1 This is a simple case that shows how the behaviour of the operator++ should be united. I'm not sure what you mean by the system(...) call... I understand that the code is undefined (meaning its up to the compiler vendor to implement as they see fit). I think the most fitting way is to have the above two cases unified in behaviour... isn't one of the reasons that operators were added to C++ was to allow user-defined types to mimic the functionality and usability of the native C types? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11751