编译器错误 C3027
“clause”: 需要算术表达式或指针表达式
需要算术表达式或指针表达式的子句传递了另一种表达式。
示例
下面的示例生成 C3027:
// C3027.cpp
// compile with: /openmp /link vcomps.lib
#include <stdio.h>
#include "omp.h"
struct MyStruct
{
int x;
} m_MyStruct;
int main()
{
int i;
puts("Test with class MyStruct:\n");
#pragma omp parallel for if(m_MyStruct) // C3027
for (i = 1; i <= 2; ++i)
printf_s("Hello World - thread %d - iteration %d\n",
omp_get_thread_num(), i);
puts("Test with int:\n");
#pragma omp parallel for if(9) // OK
for (i = 1; i <= 2; ++i)
printf_s("Hello World - thread %d - iteration %d\n",
omp_get_thread_num(), i);
}