This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[RFC] libstdc++/9817 or "passing C++ strings to C functions"
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Cc: Nathan Myers <ncm at cantrip dot org>
- Date: Sun, 23 Feb 2003 14:57:16 +0100
- Subject: [RFC] libstdc++/9817 or "passing C++ strings to C functions"
Hi,
this bug is in fact about a general issue: when using underlying
C functions for strings, any C++ string with '\0' in the middle
cannot be processed as is, in that only the first hunk ends up being
considered: the length information is lost. This is the case, in
particular, of strcoll (which we'd like to exploit for collate::compare)
and strxfrm (for collate::transform).
Now, I have got an idea: what about substituting a conventional char
for the original '\0' (f.i., '$') and then calling strcoll (strxfrm,
respectively) as usual?
Other proposals?
Paolo.