This is the mail archive of the mailing list for the glibc 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]

Re: [open-source] Re: Wish for 2002 ...

"Martin v. Loewis" wrote:

> > One approach I like very much is that of stralloc, that I first saw in
> > Amanda code.  Concatenating multiple strings into a newly-allocated
> > buffer created with the right size is as simple as stralloc(string1,
> > string2, ..., NULL);
> Notice that -liberty offers this as concat(const char* first, ...).

That strikes me as a function worth having, though perhaps not in standard
libraries. It does something standard library functions don't, and it is a
much cleaner interface than you'd get by taking Linus's strdup2() and 
adding strdup3(), ...

As for strl*() functions, consider this passage from Henry Spencer's "Ten
Commandments for C Programmers":

"	Many customs in this life persist because they ease friction and
"	promote productivity as a result of universal agreement, and 
"	whether they are precisely the optimal choices is much less
"	important.

He was talking about brace style, but I think the comment applies here.
strn*() functions may not be precisely optimal, but they should be used
in preference to strl*().

Of course his comments on checking array bounds and on not re-inventing
libray functions also apply.

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