Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Microsoft visual studio 2010 support c99?

I would like to know if Microsoft Visual Studio 2010 supports C99. If not, how can I use the standard types like intptr_t and uintptr_t?

like image 576
thetna Avatar asked Jul 14 '11 05:07

thetna


People also ask

Does Visual Studio use C99?

By default, Microsoft's Visual Studio C Compiler doesn't follow the C99 standard. If you're using Visual Studio, you can make the transition process to Unix for the Lab Assignments easier by performing the following steps.

Is Visual Studio 2010 still supported by Microsoft?

Visual Studio 2010 - Microsoft Lifecycle | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Does Visual Studio support C11?

Support for C11 and C17 standards is available in Visual Studio 2019 version 16.8 and later.


2 Answers

Visual Studio 2010 does not support C99 syntax. stdint.h is a very common file in all C/C++ compilers, though, which does exist in a Visual C++ 10.0 installation, included with the Windows SDK (regardless of the version of Visual Studio that you use).

stdint.h can be found in:

  • C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\

This file does provide a typedef for intptr_t. Feel free to use it in any C or C++ project you like.

like image 141
Andrew D'Addesio Avatar answered Oct 05 '22 08:10

Andrew D'Addesio


As far as I can tell, Visual Studio 2010 does not support C99. To use types from stdint.h, you will have to use a typedef. A cross-platform way to do this would be:

#ifdef _WIN32
typedef signed short int16_t
#else
#include <stdint.h>
#endif

See also this this question: Visual Studio support for new C / C++ standards?

like image 23
David Grayson Avatar answered Oct 05 '22 08:10

David Grayson