Le 6 juil. 2024 à 03:22, Mike Schinkel <m...@newclarity.net> a écrit :

On Jul 5, 2024, at 1:11 PM, Claude Pache <claude.pa...@gmail.com> wrote:
Le 25 juin 2024 à 16:36, Gina P. Banyard <intern...@gpb.moe> a écrit :

* About strtok(): An exact replacement of `strtok()` that is reasonably performant may be constructed with a sequence of strspn(...) and strcspn(...) calls; here is an implementation using a generator in order to keep the state: https://3v4l.org/926tC

Well your modern_strtok() function is not an _exact_ replacement as it requires using a generator and thus forces the restructure of the code that calls strtok(). 

Yes, of course, I meant: it has the exact same semantics. You cannot have the same API without keeping global state somewhere. If you use strtok() for what it was meant for, you must restructure your code if you want to eliminate hidden global state.

—Claude 

Reply via email to