From: hjl@lucon.org (H.J. Lu)
To: weimer@wrw3.resnet.cornell.edu (Westley Weimer)
Cc: egcs@cygnus.com
Subject: Re: egcs bug in c++ setw() ?
Date: Wed, 03 Dec 1997 16:29:00 -0000 [thread overview]
Message-ID: <m0xdJ2E-0004ecC@ocean.lucon.org> (raw)
In-Reply-To: <Pine.LNX.3.96.971202083040.1579A-100000@wrw3.resnet.cornell.edu>
>
>
> The last two (at least) versions of pgcc / egcs produce executables with
> strange setw() behavior. setw() does set the output width, but its
> argument overwrites whatever was going to be written next.
>
> Here's an condensed example that demonstrates the problem:
> --- begin testing.cc ---
> #include <iomanip.h>
> #include <iostream.h>
> #include <stdlib.h>
>
> int main(void)
> {
> int i;
> cout << endl << "The numbers 0 through 9 using setw(3):" << endl;
> for (i = 0 ; i <= 9 ; i++)
> cout << setw(3) << i;
> cout << endl;
> cout << "The numbers 0 through 9 using \" \" to separate:" << endl;
> for (i = 0 ; i <= 9 ; i++)
> cout << " " << i;
> cout << endl << endl;
> return(0);
> }
> --- end testing.cc ---
>
> Here's the output on various systems:
>
> turing% uname -a
> SunOS turing.csuglab.cornell.edu 5.5 Generic_103093-03 sun4m sparc
> SUNW,SPARCsystem-600
> ...
> Reading specs from
> /usr/local/gnu/gcc-2.7.2/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/specs
> gcc version 2.7.2
>
> turing% a.out
> The numbers 0 through 9 using setw(3):
> 0 1 2 3 4 5 6 7 8 9
> The numbers 0 through 9 using " " to separate:
> 0 1 2 3 4 5 6 7 8 9
>
> Everything seems fine. Using egcs on i586/linux:
>
> merentha:/tmp$ uname -a
> Linux wrw3 2.1.63 #7 Fri Nov 21 16:57:09 EST 1997 i586 unknown
> ...
> Reading specs from
> /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.06/specs
> gcc version egcs-2.90.06 970907 (gcc2-970802 experimental)
> merentha:/tmp$ a.out
> The numbers 0 through 9 using setw(3):
> 3 3 3 3 3 3 3 3 3 3
> The numbers 0 through 9 using " " to separate:
> 0 1 2 3 4 5 6 7 8 9
>
> That looks bad. Let's try again on the same computer using a more recent
> version of pgcc/egcs.
>
> Reading specs from
> /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.17p/specs
> gcc version egcs-2.90.17p 971114 (gcc2-970802 experimental)
> merentha:/tmp$ a.out
> The numbers 0 through 9 using setw(3):
> 3 3 3 3 3 3 3 3 3 3
> The numbers 0 through 9 using " " to separate:
> 0 1 2 3 4 5 6 7 8 9
>
Your test case runs fine on my linux/x86 with libc 5.4.41.
H.J.
prev parent reply other threads:[~1997-12-03 16:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-02 5:52 Westley Weimer
1997-12-03 16:29 ` H.J. Lu [this message]
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=m0xdJ2E-0004ecC@ocean.lucon.org \
--to=hjl@lucon.org \
--cc=egcs@cygnus.com \
--cc=weimer@wrw3.resnet.cornell.edu \
/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: link
Be 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).