5 ms·
What's a modern libc? Not being snide or anything: I have no idea. I didn't know where to look so I looked at glibc [1] and that, in fact, does seem to be how i
by aptwebapps 14y ago
What's a modern libc? Not being snide or anything: I have no idea. I didn't know where to look so I looked at glibc [1] and that, in fact, does seem to be how it works.
[1] http://sourceware.org/git/?p=glibc.git;a=blob;f=string/strcmp.c;h=8229d7c773b361a1587cac2cfc5d9b12ba29255a;hb=f1ecb7ef7f5703fc156b8ab2ca153d774c39ec7a http://sourceware.org/git/?p=glibc.git;a=blob;f=string/strcm...
- pirateking 14y agoI have heard of musl[1] and Bionic[2]. Interested in hearing about any others. [1] http://www.musl-libc.org/ http://www.musl-libc.org/ [2] http://en.wikipedia.org/wiki/Bionic_(software) http://en.wikipedia.org/wiki/Bionic_(software)
- justincormack 14y agoUclibc and dietlibc. Must recommend Musl for code readability and implementation quality.
- aptwebapps 14y agoThose seem to both use basically the same algo as the glibc one, all though a little more compactly written.
- pbsd 14y agoYou might want to look at the non-generic implementations, like http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/strcmp.S;h=a16d67d37e4787a197a209a1a508c46f4f68e77b;hb=f1ecb7ef7f5703fc156b8ab2ca153d774c39ec7a http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_...
- aptwebapps 14y agoI've never written anything non-trival in C and even that was ages ago so I didn't hope to be able judge the niceties of different implementations but I can't even tell what the algorithm is in that one.
- darklajid 14y agoThis might be the most delicious piece of code ever written ( I cannot judge that, really), but we're talking 2307 lines for a string comparison. I'm impressed, but also scared and amused. I always look with envy at system level guys, lacking the knowledge to play on that level. This, though, comforts me quite a bit. That's just not my definition of 'fun'.