A.27 Use of C99 Variable Length Arrays
The following example demonstrates how to use C99 Variable Length Arrays (VLAs) in a firstprivate directive (Section 2.7.2.2 on page 26).
Note |
|---|
Variable length arrays are not currently supported in Visual C++. |
void f(int m, int C[m][m])
{
double v1[m];
...
#pragma omp parallel firstprivate(C, v1)
...
}
alloca
It's a poor workaround for a 12 year old standard. It's embarrassing that Visual Studio can't compile git largely because of the c99isms in the code.
$0$0
$0
$0Instead of using filthy pragmas, it's better to use _alloca or _malloca which are available from malloc.h.$0
$0$0
$0
$0(Edit: What's up with the $0's in my post when I put in carriage returns?)$0
Poor workaround
$0This is a rather poor workaround for a standard that has been around, what, 12 years already?$0
- 6/28/2011
- CyberSkull
