0
我们是否需要在方法的声明和定义中使用restrict关键字,还是仅仅在C++代码中的声明文件中使用它就足够了?什么是正确的使用方法?在头文件和源文件中限制使用
代码编译即使没有限制在声明中的用法。
例如
Foo.h
class Foo
{
public:
void Bar(int* __restrict__ in, int* __restrict__ out);
}
Foo.cpp
void Foo::Bar(int* __restrict__ in, int* __restrict__ out)
{
}
[**“正如所有最参数预选赛,'__restrict__'在函数定义匹配忽略不计。这意味着你只需要在函数定义中指定'__restrict__',而不是在函数原型中。“**](https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html) – StoryTeller