那位朋友知道__restrict__关键字的作用是干什么?
那位朋友知道__restrict__关键字的作用是干什么?
谢谢!
下面是google的结果---我没有看明白:
As with the C front end, G++ understands the C99 feature of restricted pointers, specified with the __restrict__, or __restrict type qualifier. Because you cannot compile C++ by specifying the -std=c99 language flag, restrict is not a keyword in C++.
In addition to allowing restricted pointers, you can specify restricted references, which indicate that the reference is not aliased in the local context.
void fn (int *__restrict__ rptr, int &__restrict__ rref)
{
/* ... */
}
In the body of fn, rptr points to an unaliased integer and rref refers to a (different) unaliased integer.
You may also specify whether a member function's this pointer is unaliased by using __restrict__ as a member function qualifier.
void T::fn () __restrict__
{
/* ... */
}
Within the body of T::fn, this will have the effective definition T *__restrict__ const this. Notice that the interpretation of a __restrict__ member function qualifier is different to that of const or volatile qualifier, in that it is applied to the pointer rather than the object. This is consistent with other compilers which implement restricted pointers.
As with all outermost parameter qualifiers, __restrict__ is ignored in function definition matching. This means you only need to specify __restrict__ in a function definition, rather than in a function prototype as well
谢谢!
下面是google的结果---我没有看明白:
As with the C front end, G++ understands the C99 feature of restricted pointers, specified with the __restrict__, or __restrict type qualifier. Because you cannot compile C++ by specifying the -std=c99 language flag, restrict is not a keyword in C++.
In addition to allowing restricted pointers, you can specify restricted references, which indicate that the reference is not aliased in the local context.
void fn (int *__restrict__ rptr, int &__restrict__ rref)
{
/* ... */
}
In the body of fn, rptr points to an unaliased integer and rref refers to a (different) unaliased integer.
You may also specify whether a member function's this pointer is unaliased by using __restrict__ as a member function qualifier.
void T::fn () __restrict__
{
/* ... */
}
Within the body of T::fn, this will have the effective definition T *__restrict__ const this. Notice that the interpretation of a __restrict__ member function qualifier is different to that of const or volatile qualifier, in that it is applied to the pointer rather than the object. This is consistent with other compilers which implement restricted pointers.
As with all outermost parameter qualifiers, __restrict__ is ignored in function definition matching. This means you only need to specify __restrict__ in a function definition, rather than in a function prototype as well
...全文
相关推荐
C 语言restrict 关键字的使用浅谈
C 语言restrict 关键字的使用浅谈,需要的朋友可以参考一下
C语言中const,volatile,restrict的用法总结
以下是对C语言中const,volatile,restrict的用法进行了详细的总结介绍,需要的朋友可以过来参考下
修改__RESTRICT,__restrict工具
iOS 修改反注入标识__RESTRICT为其它值,同时具有注入功能
html-restrict:HTML :: Restrict-剥离不需要HTML标记
html-restrict:HTML :: Restrict-剥离不需要HTML标记
C++__declspec关键字详细用法
C++__declspec关键字详细用法


