Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "simulate" C99 in Visual Studio for variables declaration

I'm using Visual Studio 2012 to develop simple Win32 C programs. I know that the VS compiler only supports C89, but I'd like to know if there is a way to override this limitation.

In particular I'd like to declare variables anywhere in my code, instead of only at the beginning of scope blocks (as C89 requires).

Thanks in advance.

like image 848
eang Avatar asked Nov 09 '12 13:11

eang


1 Answers

The choices I see:

  • stick with MSVC and switch to C++
  • stick with MSVC and use a precompiler that translates C99 to C90 (Comeau, c99-to-c89)
  • switch to a toolchain that supports more recent revisions of the C language (Intel, MinGW, Clang, Pelles-C,...)
like image 161
Christoph Avatar answered Oct 06 '22 22:10

Christoph