为什么 strcpy_s 在我的系统中不存在?
Why does strcpy_s not exist anywhere on my system?
我在 Debian 8 系统上使用 clang
。我有标准的 C++ headers。然而,没有 header 定义 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))
Why does strcpy_s not exist anywhere on my system?
strcpy_s
不是 C++ 标准库提供的。
然而,strcpy_s
是自 C11 以来由 C 标准指定的。但即使在 C11 中,strcpy_s
也是可选的。所有标准库实现都不提供所有可选功能。所以,答案似乎是:因为 none 您安装的 C 标准库声明了它。
How to I get strcpy_s, strtok_s, and all the other safe string functions onto my system?
您需要找到一个实现所有这些的库,或者自己实现它们。
显然,这些不存在,因为它们不存在。并且我可以通过查找并安装它们来找到并安装它们;或者,也可以自己编写代码。显然这是一个有用的解决方案,所以让投票开始吧。
我在 Debian 8 系统上使用 clang
。我有标准的 C++ headers。然而,没有 header 定义 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))
Why does strcpy_s not exist anywhere on my system?
strcpy_s
不是 C++ 标准库提供的。
strcpy_s
是自 C11 以来由 C 标准指定的。但即使在 C11 中,strcpy_s
也是可选的。所有标准库实现都不提供所有可选功能。所以,答案似乎是:因为 none 您安装的 C 标准库声明了它。
How to I get strcpy_s, strtok_s, and all the other safe string functions onto my system?
您需要找到一个实现所有这些的库,或者自己实现它们。
显然,这些不存在,因为它们不存在。并且我可以通过查找并安装它们来找到并安装它们;或者,也可以自己编写代码。显然这是一个有用的解决方案,所以让投票开始吧。