This is the mail archive of the libstdc++-prs@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++/52: can't call c_str() from a basic_string<unsigned char>



>Number:         52
>Category:       libstdc++
>Synopsis:       can't call c_str() from a basic_string<unsigned char>
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 30 12:27:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     debian frozen
>Release:        ibstdc++2.10-dev    2.95.2-8
>Organization:
>Environment:
debian frozen
>Description:
The problem is that "" is a signed char * and so when it is 
assigned to charT* there is no problem as long as charT* 
is a signed char. The problem is if instantiate a basic 
string with an unsigned char rather than a char this doesn't
work. I don't know how this will behave with multibyte 
characters.
>How-To-Repeat:

>Fix:
RCS file: RCS/bastring.h,v
retrieving revision 1.1
diff -u -r1.1 bastring.h
--- bastring.h	2000/03/30 00:44:05	1.1
+++ bastring.h	2000/03/30 00:46:05
@@ -335,7 +335,7 @@
 
 public:
   const charT* c_str () const
-    { const charT* null_str = ""; 
+    { const charT* null_str = reinterpret_cast<const charT*>(""); 
       if (length () == 0) return null_str; terminate (); return data (); }
   void resize (size_type n, charT c);
   void resize (size_type n)
>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]