今天无意中man了下strstr,看下如果查找的str为空会发生什么。
- #include
- char *strstr(const char *haystack, const char *needle);
- ...
- Early versions of Linux libc (like 4.5.26) would not allow an empty needle argument for strstr(). Later versions (like 4.6.27) work correctly, and return haystack when needle is empty.
ubuntu下查看libc的版本号:
- /lib/libc.so.6
- 或者是:
- /lib/i386-linux-gnu/libc.so.6
阅读(1558) | 评论(0) | 转发(0) |