- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
}
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
arr
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
sum=0;
func(m, n, p);
for (int i=0; i
printf("sum=%ld ", sum);
}
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page