在 C's `extern "C"` 块中使用 c99

发布于 2024-09-18 07:35:49 字数 117 浏览 2 评论 0 原文

我想要一个用 C 编写的函数,但可以从 C++ 调用,它需要一个受限制的指针。这仅在 c99 中可用,因此 g++ 不喜欢它,即使在 extern "C" 块中也是如此。我怎样才能绕过这个限制?

I would like to have a function written in C, but callable from C++ which takes a restricted pointer. This is only available in c99, so g++ doesn't like it, even in extern "C" blocks. How can I get around this limitation?

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

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

发布评论

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

评论(1

余生再见 2024-09-25 07:35:49
#ifdef __cplusplus
#   ifdef __GNUC__
#       define restrict __restrict__ // G++ has restrict
#   else
#       define restrict // C++ in general doesn't
#   endif
#endif
#ifdef __cplusplus
#   ifdef __GNUC__
#       define restrict __restrict__ // G++ has restrict
#   else
#       define restrict // C++ in general doesn't
#   endif
#endif
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文