Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要一个用 C 编写的函数,但可以从 C++ 调用,它需要一个受限指针。这仅在 c99 中可用,因此 g++ 不喜欢它,即使在extern "C"块中也是如此。我怎样才能绕过这个限制?
extern "C"
#ifdef __cplusplus # ifdef __GNUC__ # define restrict __restrict__ // G++ has restrict # else # define restrict // C++ in general doesn't # endif #endif