This is the mail archive of the
mailing list for the libstdc++ project.
RE: [RFC] libstdc++/9817 or "passing C++ strings to C functions"
- From: Pétur Runólfsson <peturr02 at ru dot is>
- To: <pcarlini at unitus dot it>
- Cc: <libstdc++ at gcc dot gnu dot org>,"Nathan Myers" <ncm at cantrip dot org>,<bkoz at redhat dot com>,<sebor at roguewave dot com>
- Date: Mon, 24 Feb 2003 10:53:22 -0000
- Subject: RE: [RFC] libstdc++/9817 or "passing C++ strings to C functions"
Paolo Carlini wrote:
> However, I have a major concern: what about the similar issue
> we have with
> collate::transform? collate::compare and collate::transform
> should be fixed in a
> similar way, not only for general consistency sake, but also
> because they must
> be able to work together.
Isn't it possible to use the same strategy? That is break the
string into chunks separated by \0, then transform each chunk
with strxfrm (again, untested code):
const char* p = str.c_str();
const char* pend = str.c_str() + str.length();
size_t n = strxfrm(buf, p, BIGNUM);
res.insert(res.end(), buf, buf + n);
p += strlen(p);
if (p == pend)