Re: [Libclc-developers] new string functions: clc_str{n}{case}comm()
Status: Planning
Brought to you by:
augestad
|
From: Bryan D. <bd...@bd...> - 2003-03-23 17:56:32
|
=2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 23 March 2003 11:16 am, Hallvard B Furuseth wrote: > Bj=F8rn Augestad writes: > > But the functions without a length parameter may have its place in > > libclc. We can just exclude the problematic ones. :-) > > That's why I wrote "Source code for clc_strncasecomm() follows. The > others are for the time being left as an exercise for the reader." > I just posted the most complicated one, the others can be implemented > by removing some tests or function calls. > > > Here is one possible implementation, submitted for the sake of > > discussion only. > > > > (...) > > > > size_t clc_strcomm(const char* s1, const char* s2) > > Well, I already said why I think it's wrong to return size_t: > I think equal strings should return -1. If the strings have a common part at least LONG_MAX characters long, we have undefined behavior. Not so with size_t. =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+ffU2x533NjVSos4RAsHfAJwIdL5dUQUr35MP1LPNXuysSpFcvwCgqeIv 2Bd+QSd0xY3WYZSrDYtUycw=3D =3D3Oeg =2D----END PGP SIGNATURE----- |