public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/5724: Evaluation order of parameters for multiple operator<< calls
@ 2002-02-18 11:06 RaoulGough
  0 siblings, 0 replies; 3+ messages in thread
From: RaoulGough @ 2002-02-18 11:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5724
>Category:       c++
>Synopsis:       Evaluation order of parameters for multiple operator<< calls
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 18 11:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Raoul Gough
>Release:        2.95.3-5
>Organization:
>Environment:
Cygwin on Windows 2000
>Description:
I have an example where

cout << f(a) << f(b);

is calling f(b) before f(a), which I think is wrong. The operator<< is (in this case) a function call, so there should be a sequence point which guarantees evaluation order.

My apologies for submitting a bug on an old version.
>How-To-Repeat:
g++ gccseqtest.cc -o gccseqtest
./gccseqtest

Produces:
121
122

I think this should be:

122
122
>Fix:

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


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

* Re: c++/5724: Evaluation order of parameters for multiple operator<< calls
@ 2002-02-18 13:47 nathan
  0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2002-02-18 13:47 UTC (permalink / raw)
  To: RaoulGough, gcc-bugs, gcc-prs, nobody

Synopsis: Evaluation order of parameters for multiple operator<< calls

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Mon Feb 18 13:47:14 2002
State-Changed-Why:
    no, there is no sequence point there. The code is
    equivalent of
    	output (output (cout, f (a)), f (b));
    where 'output' is the operator<< function. you'll see
    that 'f (b)' can be called before or after
    'output (cout, f (a))'

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


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

* Re: c++/5724: Evaluation order of parameters for multiple operator<<  calls
@ 2002-02-18 12:26 Graham Stott
  0 siblings, 0 replies; 3+ messages in thread
From: Graham Stott @ 2002-02-18 12:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: Graham Stott <grahams@redhat.com>
To: RaoulGough@dial.pipex.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/5724: Evaluation order of parameters for multiple operator<< 
 calls
Date: Mon, 18 Feb 2002 20:18:34 +0000

 Please supply a complete testcase.


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

end of thread, other threads:[~2002-02-18 21:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-18 11:06 c++/5724: Evaluation order of parameters for multiple operator<< calls RaoulGough
2002-02-18 12:26 Graham Stott
2002-02-18 13:47 nathan

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