This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

c_str on a wstring tries to return a char*



I'm having some trouble getting a null-terminated wide character array out of a
wstring to pass to  wcstombs().  It seems that the 2.10 and cvs versions of
bastring.h in libstdc++ (not listdc++-v3) return a pointer to a string literal from
c_str().  So I get:
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3/std/bastring.h:335:
initialization to `const __wchar_t *' from `const char *
Seems like the appropriate fix would be to return a pointer to a global (ick),
a static member (yucky init), or a member (a. la data()).  BTW, what's wrong
with always returning data()?  It looks like that's what libstdc++-v3 does.

Thanks, Aaron Hope

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