Reputation: 10144
Folks, I've been using my own implementation of strtok_r() in a project for some time and thought I'd align the declaration to the standard implementation, purely for neatness.
However, the few sites I'd usually quickly check such things on didn't list it as part of string.h, so looked further afield. Other sites do list it as part of the standard string.h, but have different declarations for it
So is it or isn't it? Is there an authoritative reference either way? Thanks.
EDIT: maybe it's POSIX?
Upvotes: 1
Views: 754
Reputation: 781058
It's POSIX, not standard C. If you check the POSIX spec you'll see that it's marked with [CX], which indicates that it's an extension to the C standard. You can also find the official prototype there:
char *strtok_r(char *restrict s, const char *restrict sep,
char **restrict lasts);
If you're seeing different declarations, it may be that some of them haven't incorporated the restrict
keywords, which were added in Issue 6.
Upvotes: 4