News for hackers. Stuff that matters.
Re:String tokenization in C by zakk on Saturday December 15, 2018 @08:12AM (#18688257)
That’s not a good reason not to use it.

A function can be not thread-safe and still safe to use in single-threaded programs.

The point is that strtok is not a good choice even for single-threaded code.

Re:String tokenization in C by johnisgood on Saturday December 15, 2018 @08:31AM (#18688309)
> The point is that strtok is not a good choice even for single-threaded code.

Why isn't it a good choice exactly? Could you sum it up?

Re:String tokenization in C by enriquto on Saturday December 15, 2018 @09:04AM (#18688417)
Maybe he means that the function is not re-entrant. You cannot run a loop that tokenizes a string, and somewhere inside, you call a function that uses strtok itself. This can happen inadvertently.