How universally supported is the C99?

How universal is the C99 standard supported by modern compilers? I understand that even GCC fully supports it. Is it correct?

Which C99 features are supported more than others, i.e. What can I use to make sure that most compilers will understand me?

+44
c c99
Sep 26 '08 at 13:23
source share
7 answers

If you want to write portable C code, I suggest you write in C89 (the old ANSI C standard). This standard is supported by most compilers.

The Intel C compiler has very good support for C99 , and it creates fast binaries. (Thanks 0x69!)

MSVC supports some new features , and Microsoft plans to expand support in future versions.

GCC supports some of the new C99 stuff. They created a table on the status of the functions of C99 . Probably the most suitable C99 function is a variable-length array, and GCC supports it now. Clang (LLVM C front) supports most of the functions except for floating point plugins.

Wikipedia has a good summary of support for C99 compilers.

+20
Sep 26 '08 at 13:28
source share

Someone mentioned that the Intel compiler supports C99. There is also a Comau C / C ++ compiler that fully supports C99. These are the only ones that I know of.

C99 features that I do not use because they are poorly supported include:

  • variable length arrays
  • with a variable number of parameters.

The C99 features that I use regularly look pretty good (except for Microsoft):

  • stdint.h
  • snprintf() - MS has non-standard _snprintf() , which has serious limitations of not always zero buffer completion and does not indicate how large the buffer should be

To get around Microsoft support without support, I use the public domain stdint.h from MinGW (which I modified to also work on VC6) and the almost public domain snprintf() from Holger Weiss

Elements that are not supported by Microsoft but will continue to be used by other compilers depending on the project:

  • mixed declarations and code
  • built-in functions
  • _Pragma() - this makes pragmas much more useful
+16
Sep 26 '08 at 19:43
source share

For gcc there is a table with all the supported functions . The biggest missing seems to be variable-length arrays. Most of the other missing features are library issues, not language features.

+7
Sep 26 '08 at 13:26
source share

The IBM c compiler supports c99 when calling c99, but not when calling cc or xlc.

+5
Aug 11 '09 at 16:08
source share

Check the C99 status for GNU to find out which features are currently supported.

Sun Studio is meant to support the entire C99 specification. I have never used them, so I can’t confirm.

I do not believe that the microsoft compiler fully supports the C99 specification. They are currently much more focused on C ++.

+3
Sep 26 '08 at 13:27
source share

Clang (LLVM-based C and C ++ compiler) has pretty good support for C99. I think the only thing it doesn't support is floating point pragmas.

+3
Jan 17 '11 at 6:52
source share

Microsoft seems to be following C ++ standards, but does not support C99. (They can cherry-pick some functions, but we can say that they chose cherry C ++ 0x, where there is overlap.)

As in Visual Studio .NET 2003, in new projects, the option "Compile C-code as a C ++ (/ TP) option" is enabled by default.

+2
Sep 26 '08 at 16:16
source share



All Articles