public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9215: Problem with reserting a stream to default using setf
@ 2003-01-07 16:26 Paolo Carlini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Carlini @ 2003-01-07 16:26 UTC (permalink / raw)
To: paolo; +Cc: gcc-prs
The following reply was made to PR libstdc++/9215; it has been noted by GNATS.
From: Paolo Carlini <pcarlini@unitus.it>
To: Jon Gjerde <Jon.Gjerde@nr.no>
Cc: paolo@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: c++/9215: Problem with reserting a stream to default using setf
Date: Tue, 07 Jan 2003 17:20:57 +0100
Jon Gjerde wrote:
>Thank you for the quick reply.
>
>Is your solution cout.setf(ios_base::floatfield, ios_base::floatfield) equal
>to unsetf(ios_base::floatfield)?
>
Yes. An alternate solution would be
cout.setf(ios_base::fmtflags(0), ios_base::floatfield)
>I am now using the latter, and it seems to
>do the same as setf(0, ios_base::floatfield) when using the Sun CC compiler.
>Btw, the setf(0, ios_base::floatfield) statement is taken from an example in
>The C++ Programming language by Bjarne Stroustrup.
>
;)
Well, I may be wrong, but in the _final_ standard I cannot find examples
of a 'plain' 0 but always ios_base::fmtflags(0). Otherwise, make use of
what I replied earlier today.
Barring any additional clarification on the '0' vs ios_base::fmtflags(0)
issue, I would close the PR.
Ciao, Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9215
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/9215: Problem with reserting a stream to default using setf
@ 2003-01-07 13:36 Jon Gjerde
0 siblings, 0 replies; 4+ messages in thread
From: Jon Gjerde @ 2003-01-07 13:36 UTC (permalink / raw)
To: paolo; +Cc: gcc-prs
The following reply was made to PR libstdc++/9215; it has been noted by GNATS.
From: "Jon Gjerde" <Jon.Gjerde@nr.no>
To: <paolo@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>,
<jon.gjerde@nr.no>, <nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>
Cc:
Subject: Re: c++/9215: Problem with reserting a stream to default using setf
Date: Tue, 7 Jan 2003 14:29:07 +0100
----- Original Message -----
From: <paolo@gcc.gnu.org>
To: <gcc-bugs@gcc.gnu.org>; <gcc-prs@gcc.gnu.org>; <jon.gjerde@nr.no>;
<nobody@gcc.gnu.org>; <paolo@gcc.gnu.org>
Sent: Tuesday, January 07, 2003 1:48 PM
Subject: Re: c++/9215: Problem with reserting a stream to default using setf
> Synopsis: Problem with reserting a stream to default using setf
>
> Responsible-Changed-From-To: unassigned->paolo
> Responsible-Changed-By: paolo
> Responsible-Changed-When: Tue Jan 7 04:48:30 2003
> Responsible-Changed-Why:
> Analyzed.
> State-Changed-From-To: open->feedback
> State-Changed-By: paolo
> State-Changed-When: Tue Jan 7 04:48:30 2003
> State-Changed-Why:
> Basing on the ISO standard, what you are trying to do is not
> portable across different implementations. On the contrary
>
> cout.setf(ios_base::floatfield, ios_base::floatfield);
>
> it is and works for me.
> Works for you?
> Thanks, Paolo.
>
>
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=9215
>
Thank you for the quick reply.
Is your solution cout.setf(ios_base::floatfield, ios_base::floatfield) equal
to unsetf(ios_base::floatfield)? I am now using the latter, and it seems to
do the same as setf(0, ios_base::floatfield) when using the Sun CC compiler.
Btw, the setf(0, ios_base::floatfield) statement is taken from an example in
The C++ Programming language by Bjarne Stroustrup.
Yours, Jon Gjerde
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/9215: Problem with reserting a stream to default using setf
@ 2003-01-07 12:48 paolo
0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2003-01-07 12:48 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, jon.gjerde, nobody, paolo
Synopsis: Problem with reserting a stream to default using setf
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Tue Jan 7 04:48:30 2003
Responsible-Changed-Why:
Analyzed.
State-Changed-From-To: open->feedback
State-Changed-By: paolo
State-Changed-When: Tue Jan 7 04:48:30 2003
State-Changed-Why:
Basing on the ISO standard, what you are trying to do is not
portable across different implementations. On the contrary
cout.setf(ios_base::floatfield, ios_base::floatfield);
it is and works for me.
Works for you?
Thanks, Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9215
^ permalink raw reply [flat|nested] 4+ messages in thread
* c++/9215: Problem with reserting a stream to default using setf
@ 2003-01-07 9:56 jon.gjerde
0 siblings, 0 replies; 4+ messages in thread
From: jon.gjerde @ 2003-01-07 9:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 9215
>Category: c++
>Synopsis: Problem with reserting a stream to default using setf
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Jan 07 01:56:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Jon Gjerde
>Release: gcc version 3.1.1
>Organization:
>Environment:
SunOS lyra 5.8 Generic_108528-12 sun4u sparc SUNW,Sun-Fire-280R
/local/gcc3.1.1/bin/g++ -v
Reading specs from /local/gcc3.1.1/lib/gcc-lib/sparc-sun-solaris2.8/3.1.1/specs
Configured with: ./configure --prefix=/local/gcc3.1.1
Thread model: posix
>Description:
stream.C: In function `int main()':
stream.C:15: invalid conversion from `int' to `std::_Ios_Fmtflags'
stream.C:15: initializing argument 1 of `std::_Ios_Fmtflags
std::ios_base::setf(std::_Ios_Fmtflags, std::_Ios_Fmtflags)'
>How-To-Repeat:
Compile the following:
--- Begin Source ---
#include <iostream>
#include <fstream>
using std::cout;
using std::endl;
using std::ios_base;
int main()
{
double a = 1234.56789;
cout << a << endl;
cout.setf(ios_base::scientific, ios_base::floatfield);
cout << a << endl;
cout.setf(0, ios_base::floatfield); // Return to default output
cout << a << endl;
}
--- End source ---
>Fix:
Use the cc: Sun WorkShop 6 update 1 compiler :-)
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-01-07 16:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-07 16:26 c++/9215: Problem with reserting a stream to default using setf Paolo Carlini
-- strict thread matches above, loose matches on Subject: below --
2003-01-07 13:36 Jon Gjerde
2003-01-07 12:48 paolo
2003-01-07 9:56 jon.gjerde
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).