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

icpc with old style Kernighan & Ritchie C

Arthur4
Beginner
886 Views

Hello,

I have an old C program I need to compile. It's been written in the old style C from the original Kernighan and Ritchie standard:

myfunc(a,b)

int a, b;

{

/* code */

}

I have been asked to use icpc. I have installed the latest version of icpc available for download today (10/26/2021). It's not surprising that I'm getting lots of errors.

Is there a compiler flag for icpc that will allow me to compile this old program?

Thanks.

0 Kudos
1 Solution
ShivaniK_Intel
Moderator
737 Views

Hi,


 >>>Is there a compiler flag for icpc that will allow me to compile this old program?

 

Sorry for the inconvenience. Unfortunately, there is no compiler flag for icpc that will allow you to compile the old C Program.

 

 Thanks & Regards

 Shivani


View solution in original post

0 Kudos
6 Replies
ShivaniK_Intel
Moderator
852 Views

Hi,


Thanks for reaching out to us.


Thanks for reporting. We are able to reproduce the issue . We are working on it and will get back to you soon.


Thanks & Regards

Shivani




0 Kudos
Viet_H_Intel
Moderator
828 Views

You can use icc instead of icpc on C file.

$ cat t2.c

#include<stdio.h>


int myfunc();


int myfunc(a,b)

int a,b;

{

  int c;

  c =a+b;

  return c;

}

$ icc t2.c -c

$



0 Kudos
Arthur4
Beginner
799 Views

Thanks to Shivani and Viet. We have some company requirements on icpc, and I will wait for Shivani to determine whether there's a compiler flag that can be set to avoid having to use a different compiler or worse, rewriting that code!

0 Kudos
Viet_H_Intel
Moderator
794 Views

AFAIK, there isn't an option so that icpc will accept the code. g++ won't compile it neither.

Thanks,



0 Kudos
ShivaniK_Intel
Moderator
738 Views

Hi,


 >>>Is there a compiler flag for icpc that will allow me to compile this old program?

 

Sorry for the inconvenience. Unfortunately, there is no compiler flag for icpc that will allow you to compile the old C Program.

 

 Thanks & Regards

 Shivani


0 Kudos
ShivaniK_Intel
Moderator
707 Views

Hi,


Thanks for accepting our solution. If you need any additional information please post a new question as this thread will no longer be monitored by intel.


Thanks & Regards

Shivani


0 Kudos
Reply