Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

C99 support in icpc

hraiesi
Beginner
675 Views
I have difficulties compiling the following code using icpc, icc works fine with
the VLA feature of C99, but it seems icpc doesn't support it?
I assumed using -std=c99 will enable VLA feature of C99 in icpc? Am I right?
PS. : I have a mixed C/C++ code which I need to compile by icpc.

#include
#include

void func(int m, int n, int arr)
{
long int sum=0;
printf("size of arr = %d,%d ", m,n);
for (int i=0; i for (int j=0; j {
arr=i+j;
sum+=arr;
}
printf("sum = %ld ", sum);
}

int main()
{
long int d,sum;
int m, n;
printf("enter size : ");
scanf("%d %d", &m, &n);
int p;

for (int i=0; i for (int j=0; j p= i + j;
sum=0;
func(m, n, p);
for (int i=0; i for (int j=0; j sum+=p;

printf("sum=%ld ", sum);

}


0 Kudos
2 Replies
TimP
Honored Contributor III
675 Views
If you are using a recent icpc 9.1, and have a problem which works with g++, you should submit a report on premier.intel.com. Recent 9.1 compilers have some compatibility with g++ 4.1, but possibly not full compatibility. I don't think g++ accepts -std=c99, although gcc does, so I wouldn't count on this working with icpc.
0 Kudos
Dale_S_Intel
Employee
675 Views

Well, I'm not a language lawyer, but C99 is a C standard, not a C++ standard, so I would not expect to be able to use C99 specific features in C++. I believe certain C99 features are incompatible with the C++ standard, and so are unlikely to be included in C++, though I don't remember if VLA's are among those.

Dale

0 Kudos
Reply