sprintf_s问题。它在Windows上工作,但在Xcode上不起作用

发布于 2025-02-11 02:41:21 字数 168 浏览 2 评论 0原文

sprintf_s(colorBuffer, 255, "%.2X", getAlpha());
result.append(colorBuffer);

错误是:

使用未宣布的标识符'sprintf_s'

sprintf_s(colorBuffer, 255, "%.2X", getAlpha());
result.append(colorBuffer);

The error is:

Use of undeclared identifier 'sprintf_s'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傾城如夢未必闌珊 2025-02-18 02:41:21

sprintf_s是C11标准的一部分附件K,标题为“界限检查接口” 。附件K是可选的。

附件K没有成功。 在1995年说:

尽管原始提案和将近十年以来十多年
自ISO/IEC TR 24731-1:2007批准以来,几乎
自引入边界检查界面以来五年
进入C标准,没有出现可行的符合实现。
API继续引起争议,并要求实施
继续被实施者拒绝。

作者甚至提出:

...该附件K要么从下一个删除
修订C标准或弃用然后删除。

实施它(或部分)的唯一主要编译器是Visual Studio。 XCode(基于Clang)或GCC没有运气。

sprintf_s is part annex K of the C11 standard, titled "bounds-checking interfaces". Annex K is optional.

Annex K hasn't been successful. N1967 Field Experience With Annex K — Bounds Checking Interfaces stated in 1995:

Despite more than a decade since the original proposal and nearly ten
years since the ratification of ISO/IEC TR 24731-1:2007, and almost
five years since the introduction of the Bounds checking interfaces
into the C standard, no viable conforming implementations has emerged.
The APIs continue to be controversial and requests for implementation
continue to be rejected by implementers.

The authors even propose:

... that Annex K be either removed from the next
revision of the C standard, or deprecated and then removed.

The only major compiler to implement it (or part of it) is Visual Studio. No luck with Xcode (based on clang) or gcc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文