public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: rppawlo@sandia.gov To: gcc-gnats@gcc.gnu.org Subject: c++/10159: setiosflags(ios::right) is broken Date: Thu, 20 Mar 2003 02:06:00 -0000 [thread overview] Message-ID: <20030320020448.19222.qmail@sources.redhat.com> (raw) >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=
reply other threads:[~2003-03-20 2:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030320020448.19222.qmail@sources.redhat.com \ --to=rppawlo@sandia.gov \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).