Thoughts on bug 15884

Paul Eggert eggert@cs.ucla.edu
Tue Sep 16 19:11:00 GMT 2014


On 09/16/2014 09:20 AM, Rich Felker wrote:
>> I don't know what strxfrm is good for in practice.
> Obviously the case where it matters is where each of your strings is
> in the form of a common large prefix and a tiny difference at the end.
> Here strcoll will perform pathologically bad (at least without some
> kind of memoization) and strxfrm solves the problem.

I know the *theory*.  But I don't see how strxfrm is a win in *practice*.

Long ago I asked someone on the C committee why it was in the standard, 
and he answered that it seemed like a good idea back in the 1980s, and 
that it'd be too painful to remove from the C standard now.  He (and I) 
couldn't provide any examples of it being used in practical software.

glibc dutifully implements strxfrm; but not efficiently, which is fine.  
Why bother to improve the performance of a function that's practically 
useless?

strcoll, on the other hand, is a big deal.  Making it go faster would be 
a real win.



More information about the Libc-alpha mailing list