【发布时间】:2012-10-06 15:06:30
【问题描述】:
考虑这两个函数:
void foo(char * __restrict localPtr)
{
// some work with localPtr
}
void bar(char * __restrict ptr)
{
// some work with ptr
foo(_ptr);
// some other work with ptr
}
由于ptr 已在bar 中声明为__restrict,调用foo() 危险吗?危险是指localPtr 指向的内存区域与ptr 的内存区域重叠。对此有何指导方针?
【问题讨论】:
-
Isn'
restrict仅对 多个 指针参数有用还是我记错了?