public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9618: ternary operator does not associate properly
@ 2003-02-08  3:37 bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: bangerth @ 2003-02-08  3:37 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gpeters, nobody

Synopsis: ternary operator does not associate properly

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Sat Feb  8 03:37:07 2003
State-Changed-Why:
    I can confirm the behavior you are getting. However, the
    "1" you get is what I get with all compilers I have
    access to: several versions of gcc, Intel icc, and Compaq
    cxx. Can you elaborate why you think that the result should
    be zero? What are the normative clauses of the respective
    standards?
    
    Thanks
      Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9618


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/9618: ternary operator does not associate properly
@ 2003-02-08  3:49 bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: bangerth @ 2003-02-08  3:49 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gpeters, nobody

Synopsis: ternary operator does not associate properly

State-Changed-From-To: feedback->closed
State-Changed-By: bangerth
State-Changed-When: Sat Feb  8 03:49:53 2003
State-Changed-Why:
    Given collective feedback, this report seems to be in error.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9618


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/9618: ternary operator does not associate properly
@ 2003-02-07 22:46 Gavin Peters
  0 siblings, 0 replies; 5+ messages in thread
From: Gavin Peters @ 2003-02-07 22:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9618; it has been noted by GNATS.

From: Gavin Peters <gpeters@maul.deepsky.com>
To: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9618: ternary operator does not associate properly
Date: Fri, 7 Feb 2003 17:40:35 -0500 (EST)

 On 7 Feb 2003, Falk Hueffner wrote:
 
 > gpeters@deepsky.com writes:
 >
 > > #include <stdio.h>
 > > int main( int c, char*v[])
 > > {
 > >     printf( "%d", 1?1:0?0:0);
 > >     return 0;
 > > }
 > >
 > > the above program returns 1, the C++ standard associates the ?:
 > > operator left to right, not right to left, and thus it should return
 > > 0.  The binding being used is as for C.
 >
 > Are you sure? My standard says: "Conditional expressions group
 > right-to-left." [5.16.1] Therefore, gcc's behaviour seems correct to
 > me. It would also occur to me as very weird if C++ would intentionally
 > break C compatibility here.
 
 Since writing that, I've come to believe my bug report was in error,
 please accept my apologies.  I was going on "The C++ Programming Language"
 by Stroustrup, which had confusing language.
 
 - Gavin
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/9618: ternary operator does not associate properly
@ 2003-02-07 22:46 Falk Hueffner
  0 siblings, 0 replies; 5+ messages in thread
From: Falk Hueffner @ 2003-02-07 22:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9618; it has been noted by GNATS.

From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: gpeters@deepsky.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9618: ternary operator does not associate properly
Date: 07 Feb 2003 23:38:45 +0100

 gpeters@deepsky.com writes:
 
 > #include <stdio.h>
 > int main( int c, char*v[])
 > {
 >     printf( "%d", 1?1:0?0:0);
 >     return 0;
 > }
 > 
 > the above program returns 1, the C++ standard associates the ?:
 > operator left to right, not right to left, and thus it should return
 > 0.  The binding being used is as for C.
 
 Are you sure? My standard says: "Conditional expressions group
 right-to-left." [5.16.1] Therefore, gcc's behaviour seems correct to
 me. It would also occur to me as very weird if C++ would intentionally
 break C compatibility here.
 
 -- 
 	Falk


^ permalink raw reply	[flat|nested] 5+ messages in thread

* c++/9618: ternary operator does not associate properly
@ 2003-02-07 19:56 gpeters
  0 siblings, 0 replies; 5+ messages in thread
From: gpeters @ 2003-02-07 19:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: gpeters


>Number:         9618
>Category:       c++
>Synopsis:       ternary operator does not associate properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 07 19:56:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     gpeters@deepsky.com
>Release:        unknown-1.0
>Organization:
>Environment:
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.4
>Description:
#include <stdio.h>
int main( int c, char*v[])
{
    printf( "%d", 1?1:0?0:0);
    return 0;
}

the above program returns 1, the C++ standard associates the ?: operator left to right, not right to left, and thus it should return 0.  The binding being used is as for C.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-02-08  3:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-08  3:37 c++/9618: ternary operator does not associate properly bangerth
  -- strict thread matches above, loose matches on Subject: below --
2003-02-08  3:49 bangerth
2003-02-07 22:46 Falk Hueffner
2003-02-07 22:46 Gavin Peters
2003-02-07 19:56 gpeters

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).