我想要一个用 C 编写的函数,但可以从 C++ 调用,它采用受限指针。这仅在 c99 中可用,因此 g++ 不喜欢它,即使在 extern "C"
block 中也是如此。我怎样才能绕过这个限制?
最佳答案
#ifdef __cplusplus
# ifdef __GNUC__
# define restrict __restrict__ // G++ has restrict
# else
# define restrict // C++ in general doesn't
# endif
#endif
关于c++ - 在 C+ +'s ` extern "C"` block 中使用 c99,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3689239/