bug-lib-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in std::basic_string header (bastring.h) which breaks compilation


From: Yitzi Jacob
Subject: Bug in std::basic_string header (bastring.h) which breaks compilation
Date: Tue, 20 Mar 2001 12:55:35 +0200

gcc version 2.95.2 19991024 (release)

The std::basic_string class header file has a minor oversight which causes a
major bug.
I couldn't create a basic_string who's type was a wchar_t because of poorly
written basic_string::c_str() function.. (I changed the header so I could
compile (if not link) my code) the diff is below.. I didn't send it in as
patch because I don't know what would technically be the proper correction,
I only know for sure that it is currently incorrect.

c_str() returns an empty string (if length() == 0) when it should return
some form of an empty string casted to whatever type charT happens to be.

This bug breaks compilation. (perhaps there is a switch that would allow it
to continue but I didn't find one)

address@hidden:/usr/local/lib/gcc-lib> find / -name bastring.h |& grep string
/usr/local/include/g++-3/std/bastring.h
/export/home/michael/gcc_2.95.2/gcc-2.95.2/libstdc++/std/bastring.h
address@hidden:/usr/local/lib/gcc-lib> diff
/usr/local/include/g++-3/std/bastring.h
/export/home/michael/gcc_2.95.2/gcc-2.95.2/libstdc++/std/bastring.h
335c335
<     { if (length () == 0) return (charT*)'\0'; terminate (); return data
(); }
---
>     { if (length () == 0) return ""; terminate (); return data (); }


sorry if i provided too much or too little information, hope it helps :)

yitz..




reply via email to

[Prev in Thread] Current Thread [Next in Thread]