对二维数组函数参数使用 restrict 关键字的语法是什么?
What is the syntax for using the restrict keyword for a 2d array function parameter?
我在主函数中声明了一个数组:
float A[n][n];
我的目标是将它传递给带有 restrict
关键字的函数:
void func(int n, float restrict A[][n])
我尝试了上面的语法,但我没有在 运行 时间内获得预期的优化。我还看到了 1d 数组的这种语法:
void func(int n, float A[restrict])
指针可以被限制。以下所有形式都是等效的:
void func(int n, float A[restrict n][n]);
void func(int n, float A[restrict][n]);
void func(int n, float (* restrict A)[n]);
我在主函数中声明了一个数组:
float A[n][n];
我的目标是将它传递给带有 restrict
关键字的函数:
void func(int n, float restrict A[][n])
我尝试了上面的语法,但我没有在 运行 时间内获得预期的优化。我还看到了 1d 数组的这种语法:
void func(int n, float A[restrict])
指针可以被限制。以下所有形式都是等效的:
void func(int n, float A[restrict n][n]);
void func(int n, float A[restrict][n]);
void func(int n, float (* restrict A)[n]);