From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9892 invoked by alias); 22 Jul 2003 23:19:59 -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 9881 invoked by uid 48); 22 Jul 2003 23:19:58 -0000 Date: Tue, 22 Jul 2003 23:19:00 -0000 Message-ID: <20030722231958.9879.qmail@sources.redhat.com> From: "msimons at simons-clan dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20030722205341.11633.msimons@simons-clan.com> References: <20030722205341.11633.msimons@simons-clan.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/11633] g++ does not initialize structures when auto-increment variables are used X-Bugzilla-Reason: CC X-SW-Source: 2003-07/txt/msg02662.txt.bz2 List-Id: PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11633 ------- Additional Comments From msimons at simons-clan dot com 2003-07-22 23:19 ------- A friend pointed out language in the gcc.info file which appears to cover the 'comma' ordering case: === * Making side effects happen in the same order as in some other compiler. It is never safe to depend on the order of evaluation of side effects. For example, a function call like this may very well behave differently from one compiler to another: void func (int, int); int i = 2; func (i++, i++); There is no guarantee (in either the C or the C++ standard language definitions) that the increments will be evaluated in any particular order. Either increment might happen first. `func' might get the arguments `2, 3', or it might get `3, 2', or even `2, 2'. === I'm not sure if this applies here... and if it *does* apply it seems inconsistant that things like: ++foo-1, ++foo-1 ... foo++ + 0, foo++ + 0 ... and value(), value()... all get evaluated left to right, but foo++, foo++ value gets looked up once, and gets somehow the increment happens N times. I am very interested in what the c++ language lawyers have to say about this sample. If it is truely undefined I am *amazed* that practically all of the remaining commercial unix, c++ compilers do it the same way.