“strlcpy and how CPUs can defy common sense”

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?]

=> Lomuto's comeback [Andrei Alexandrescu]

=> » Languages » C

Proxy Information
Original URL
gemini://dcreager.net/languages/c/strlcpy-common-sense.gmi
Status Code
Success (20)
Meta
text/gemini;lang=en
Capsule Response Time
553.823715 milliseconds
Gemini-to-HTML Time
0.252756 milliseconds

This content has been proxied by September (3851b).