4 ms·
reading the source code of these essential functions like ´strlen strcpy´ etc is like magician showing you how the trick is performed. and it feels utterly dev
by makach 5y ago
reading the source code of these essential functions like ´strlen strcpy´ etc is like magician showing you how the trick is performed.
and it feels utterly devastating, like I have been cheated, the banality of how it works and how simple it really is...
- pjc50 5y agoI'm not really sure what you were expecting?
- f00zz 5y agoIf that's too simple for you, you may have fun with the strlen implementation in glibc: https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=string/strlen.c;hb=HEAD https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=strin...
- saagarjha 5y agoThen look at the strlen that is probably running on your computer: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/strlen.S https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86...
- makach 5y agoExcellent reply! Thanks! ..and also thanks for pointing out the obvious *magic in the code!
- kevin_thibedeau 5y agoNeeds a static assert instead of abort().