public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8090: std::ofstream::write() wont compile when passed unsigned char[] as an argument in gcc-3.2
@ 2002-10-02 19:56 Phil Edwards
0 siblings, 0 replies; 2+ messages in thread
From: Phil Edwards @ 2002-10-02 19:56 UTC (permalink / raw)
To: pme; +Cc: gcc-prs
The following reply was made to PR libstdc++/8090; it has been noted by GNATS.
From: Phil Edwards <phil@jaj.com>
To: jsantiago@chrysalisdev.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/8090: std::ofstream::write() wont compile when passed unsigned char[] as an argument in gcc-3.2
Date: Wed, 2 Oct 2002 22:53:55 -0400
On Sun, Sep 29, 2002 at 06:36:50PM -0000, jsantiago@chrysalisdev.com wrote:
> >Description:
> The following progra is valid
No, it isn't. Sorry. :-) The C++ standard specifically mentions
that the write() member function is not overloaded for signed and
unsigned char. You will need to cast it, probably first through a void*.
(Stupid unsigned/signed rules.)
Phil
--
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
- Edsger Dijkstra, 1930-2002
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/8090: std::ofstream::write() wont compile when passed unsigned char[] as an argument in gcc-3.2
@ 2002-09-29 11:46 jsantiago
0 siblings, 0 replies; 2+ messages in thread
From: jsantiago @ 2002-09-29 11:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 8090
>Category: c++
>Synopsis: std::ofstream::write() wont compile when passed unsigned char[] as an argument in gcc-3.2
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Sun Sep 29 11:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Jose Santiago
>Release: gcc 3.2
>Organization:
>Environment:
System: Linux hpc003 2.4.19pre1 #4 SMP Fri Mar 1 09:30:24 CST 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/appl/gcc-3.2 --disable-shared --enable-threads --enable-version-specific-runtime-libs --with-included-gettext
Thread model: posix
gcc version 3.2
>Description:
The following progra is valid but will not compile under gcc-3.2. I also tried gcc-3.0.2 which has same problem:
#include <iostream>
#include <fstream>
int main(void)
{
unsigned char buffer[2];
buffer[0] = 0;
buffer[1] = 1;
std::ofstream outfile("outfile");
if (!outfile.good())
{
std::cerr << "Error Opening Output File.\n";
return 1;
}
outfile.put(buffer[0]);
//The following line will not compile under gcc-3.2 when
//buffer is of type unsigned char[], but will if it is
//of type char[]. This code compiled fine prior to
//gcc-3.0.
outfile.write(buffer,2);
outfile.close();
return 0;
}
>How-To-Repeat:
Built the attached program using gcc-3.2, gcc-3.0.2, and possible other gcc-3.x compilers.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="main.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="main.cpp"
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KCmludCBtYWluKHZvaWQpCnsK
ICB1bnNpZ25lZCBjaGFyIGJ1ZmZlclsyXTsKICBidWZmZXJbMF0gPSAwOwogIGJ1ZmZlclsxXSA9
IDE7CiAgc3RkOjpvZnN0cmVhbSBvdXRmaWxlKCJvdXRmaWxlIik7CiAgaWYgKCFvdXRmaWxlLmdv
b2QoKSkKICB7CiAgICBzdGQ6OmNlcnIgPDwgIkVycm9yIE9wZW5pbmcgT3V0cHV0IEZpbGUuXG4i
OwogICAgcmV0dXJuIDE7CiAgfQogIG91dGZpbGUucHV0KGJ1ZmZlclswXSk7Ci8vVGhlIGZvbGxv
d2luZyBsaW5lIHdpbGwgbm90IGNvbXBpbGUgdW5kZXIgZ2NjLTMuMiB3aGVuIGJ1ZmZlciBpcyBv
ZiB0eXBlCi8vdW5zaWduZWQgY2hhcltdLCBidXQgd2lsbCBpZiBpdCBpcyBvZiB0eXBlIGNoYXJb
XS4gVGhpcyBjb2RlIGNvbXBpbGVkCi8vZmluZSBwcmlvciB0byBnY2MtMy4wLgogIG91dGZpbGUu
d3JpdGUoYnVmZmVyLDIpOwogIG91dGZpbGUuY2xvc2UoKTsKICByZXR1cm4gMDsKfQo=
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-10-03 2:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-02 19:56 c++/8090: std::ofstream::write() wont compile when passed unsigned char[] as an argument in gcc-3.2 Phil Edwards
-- strict thread matches above, loose matches on Subject: below --
2002-09-29 11:46 jsantiago
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).