💾 Archived View for dcreager.net › languages › c › strlcpy-common-sense.gmi captured on 2024-08-18 at 18:04:57. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
2024-07-26
strlcpy and how CPUs can defy common sense [NRK]
A nice analysis of _how_ scanning a string twice (‘strlen’ + ‘memcpy’) can be faster than scanning it once (‘strlcpy’).
Also contains a link to a fun (possibly made up?) quote from Tony Hoare in a discussion with Nico Lomuto.
Computers do not have common sense. Computers are surprising.
–Tony Hoare [possibly?]