public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10159: setiosflags(ios::right) is broken
@ 2003-03-20  2:06 rppawlo
  0 siblings, 0 replies; only message in thread
From: rppawlo @ 2003-03-20  2:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10159
>Category:       c++
>Synopsis:       setiosflags(ios::right) is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 20 02:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     rppawlo@sandia.gov
>Release:        unknown-1.0
>Organization:
>Environment:
debian-gnu linux 2.4.19
>Description:
Once you use the line setiosflags(ios::right) then 
subsequent calls to setiosflags(ios::left) do not work.
It get stuck on right only.  The following code demonstrates
this:

#include <cstdlib>
#include <iomanip>
#include <iostream>
using namespace std;
//using std::ostream;
int main(int argc, char *argv[]) {

  cout << setiosflags(ios::left) << setw(15) << setfill('.');
  cout << "Converged";
  cout << "YES" << endl;

  cout << setiosflags(ios::right) << setfill('*');
  cout << endl;

  cout << setiosflags(ios::left) << setw(15) << setfill('.');
  cout << "Converged";
  cout << "YES" << endl;
  return 0;
}


If I compile with:
 g++ (GCC) 3.2.3 20030309 (Debian prerelease)
the output is:

mythdrannor 18:47 > a.out
Converged......YES

......ConvergedYES

If I run with g++ version 2.95 the correct output is given:

mythdrannor 18:47 > a.out
Converged......YES

Converged......YES


I am running debian linux with the 3.2 compilers currently 
in the unstable branch.
>How-To-Repeat:
See attached file.  Compile and run with 2.95 to see the 
correct output.  g++-3.2 give a reversed output for the
final print statement.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="main.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="main.C"

I2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxpb21hbmlwPgojaW5jbHVkZSA8aW9zdHJlYW0+
CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Ci8vdXNpbmcgc3RkOjpvc3RyZWFtOwppbnQgbWFpbihpbnQg
YXJnYywgY2hhciAqYXJndltdKSB7CgogIGNvdXQgPDwgc2V0aW9zZmxhZ3MoaW9zOjpsZWZ0KSA8
PCBzZXR3KDE1KSA8PCBzZXRmaWxsKCcuJyk7CiAgY291dCA8PCAiQ29udmVyZ2VkIjsKICBjb3V0
IDw8ICJZRVMiIDw8IGVuZGw7CgogIGNvdXQgPDwgc2V0aW9zZmxhZ3MoaW9zOjpyaWdodCkgPDwg
c2V0ZmlsbCgnKicpOwogIGNvdXQgPDwgZW5kbDsKCiAgY291dCA8PCBzZXRpb3NmbGFncyhpb3M6
OmxlZnQpIDw8IHNldHcoMTUpIDw8IHNldGZpbGwoJy4nKTsKICBjb3V0IDw8ICJDb252ZXJnZWQi
OwogIGNvdXQgPDwgIllFUyIgPDwgZW5kbDsKICByZXR1cm4gMDsKfQo=


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-20  2:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-20  2:06 c++/10159: setiosflags(ios::right) is broken rppawlo

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