Sod*_*hty 3 c++ debian header clang
我正在使用clangDebian 8系统.我有标准的C++标头.然而,没有标题定义strcpy_s.为什么是这样?
# grep -iRHI 'strcpy_s' /usr 2>/dev/null
/usr/include/x86_64-linux-gnu/bits/string2.h: ? __strcpy_small (dest, __strcpy_args (src), \
/usr/include/x86_64-linux-gnu/bits/string2.h:__STRING_INLINE char *__strcpy_small (char *, __uint16_t, __uint16_t,
/usr/include/x86_64-linux-gnu/bits/string2.h:__strcpy_small (char *__dest,
/usr/include/x86_64-linux-gnu/bits/string2.h:__STRING_INLINE char *__strcpy_small (char *, __STRING2_COPY_ARR2,
/usr/include/x86_64-linux-gnu/bits/string2.h:__strcpy_small (char *__dest,
/usr/src/broadcom-sta-6.30.223.248/src/include/bcmutils.h:#define bcm_strcpy_s(dst, noOfElements, src) strcpy((dst), (src))
Run Code Online (Sandbox Code Playgroud)
为什么我的系统上的strcpy_s不存在?
strcpy_s C++标准库不提供.
strcpy_s但是,自C11以来,由C标准规定.但即使在C11中,strcpy_s也是可选的.所有标准库实现都不提供所有可选功能.所以,答案似乎是:因为你安装的C标准库都没有声明它.
如何在我的系统上获得strcpy_s,strtok_s和所有其他安全字符串函数?
您需要找到一个可以全部实现它们的库,或者自己实现它们.
显然,这些不存在,因为它们不存在。我可以通过查找并安装它们来找到并安装它们;或者,也可以自己编码。显然这是一个有用的解决方案,所以让我们开始投票吧。
| 归档时间: |
|
| 查看次数: |
1237 次 |
| 最近记录: |