This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

[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.


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