Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to compile pre-ANSI (K&R-style) C code with Visual C++?

We have some old C code with pre-ANSI (K&R-style) function declarations. For example:

int foo(x, y)
double x, y;
{
    /* do some stuff */
}

Is there a compiler switch to enable support for this in Visual C++ 2008?

like image 999
Daniel Pryden Avatar asked Jan 20 '12 23:01

Daniel Pryden


1 Answers

In order to get this to compile put the code in a .c file vs. a .cpp. This instructs Visual Studio to compile the code as C instead of C++

like image 150
JaredPar Avatar answered Sep 28 '22 21:09

JaredPar