3 ms·
Note though that strsep() is not as portable, because it is an extension to standard C.
by caf 8y ago
Note though that strsep() is not as portable, because it is an extension to standard C.
- beefhash 8y agoIn fact, it's not even in POSIX.
- teddyh 8y agoTo quote the GNU C library manual: “This function was introduced in 4.3BSD and therefore is widely available.”¹ 1. https://www.gnu.org/software/libc/manual/html_node/Finding-Tokens-in-a-String.html#index-strsep https://www.gnu.org/software/libc/manual/html_node/Finding-T...
- johannes1234321 8y agoWidely except Windows and different embedded platforms etc.
- tptacek 8y agoIt's a tiny function, written in ANSI C, so if you're really concerned about this, just include it with your program. It's an extension to the standard C library, not to C itself.
- beefhash 8y agoExcept then you have the issue about compilers complaining about double-declarations of the function, meaning you'll either have a lot of warning spam on every #include or now hard require some kind of header defines for HAVE_STRSEP. Once you go that way, there's no going back and it's only gonna become more and more.
- tptacek 8y agoPeople have been including strsep in packages since the 1990s (people used to include their own snprintfs, ffs). If you're really this freaked out about it, call your local copy "mystrsep" or something like that. You know what else isn't in POSIX? All the rest of your C code.