C99

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Cover of the C99 standards document

C99 is an informal name for ISO/IEC 9899:1999, a past version of the C programming language standard. It extends the previous version (C90) with new linguistic and library features, and helps implementations make better use of available computer hardware and compiler technology.

Contents

[edit] History

After ANSI produced the official standard for the C programming language in 1989, which became an international standard in 1990, the C language specification remained relatively static for some time, while C++ continued to evolve, largely during its own standardization effort. Normative Amendment 1 created a new standard for C in 1995, but only to correct some details of the 1989 standard and to add more extensive support for international character sets. The standard underwent further revision in the late 1990s, leading to the publication of ISO/IEC 9899:1999 in 1999, which was adopted as an ANSI standard in May 2000. The language defined by that version of the standard is commonly referred to as "C99." The international C standard is maintained by the working group ISO/IEC JTC1/SC22/WG14.

[edit] Design

C99 is, for the most part, backward compatible with C89 but is stricter in some ways.

In particular, a declaration that lacks a type specifier no longer has int implicitly assumed. The C standards committee decided that it was of more value for compilers to diagnose inadvertent omission of the type specifier than to silently process legacy code that relied on implicit int. In practice, compilers are likely to display a warning, then assume int and continue translating the program.

C99 introduced several new features, many of which had already been implemented as extensions in several compilers:

Parts of the C99 standard are included in the current version of the C++ standard, C++11, including integer types, header files, and library functions. Variable-length arrays are not among these included parts because C++'s Standard Template Library already includes similar functionality.

[edit] Implementations

Most C compilers now have support for at least some of the features new to C99. However, there has been less support from vendors such as Microsoft that have mainly focused on C++.

Implementation Level of support Details
AMD x86 Open64 Compiler Suite Mostly Has C99 support equal to that of GCC.[1]
cc65 Partial Full C89 and C99 support is not implemented, partly due to platform limitations (MOS Technology 6502). There is no support planned for some C99 types like _Complex and 64-bit integers (long long).[2]
Ch Partial Supports major C99 features.[3]
Clang Mostly Does not support C99 floating-point pragmas.[4]
C++ Builder Mostly
[citation needed]
Digital Mars C/C++ Compiler Partial Lacks support for some features, such as tgmath.h and _Pragma.[5]
GCC Mostly As of July 2011 in mainline GCC, 43 features have been completely implemented (12 suffer library issues), 1 feature is broken and 6 are missing.[6] The latest stable release, GCC 4.6, also provides the same level of compliance.[7]
IBM C for AIX, V6 [8] and XL C/C++ V11.1 for AIX [9] Full
IBM Rational logiscope Full Until Logiscope 6.3, only basic constructs of C99 were supported. C99 is officially supported in Logiscope 6.4 and later versions.[10]
The Portland Group PGI C/C++ Full
Intel C++ compiler Mostly
Microsoft Visual C++ No As of Visual C++ 2010, there are no plans to support C99.[11][12]
Open Watcom Partial Implements the most-used parts of the standard. However, they are enabled only through an undocumented command-line switch.[13]
Pelles C Mostly Supports most C99 features.
Portable C compiler Partial Working towards becoming C99-compliant.
Sun Studio Full[14]
Tiny C Compiler Mostly Does not support complex numbers or variable length arrays.[15] The developers state that "TCC is heading toward full ISOC99 compliance".[16]

[edit] Version detection

A standard macro __STDC_VERSION__ is defined with value 199901L to indicate that C99 support is available. As with the __STDC__ macro for C90, __STDC_VERSION__ can be used to write code that will compile differently for C90 and C99 compilers, as in this example that ensures that inline is available in either case (by replacing it with static in C90 to avoid linker errors.)

#if __STDC_VERSION__ >= 199901L
  /* "inline" is a keyword */
#else
# define inline static
#endif

[edit] Future work

Since ratification of the 1999 C standard, the standards working group has prepared technical reports specifying improved support for embedded processing, additional character data types (Unicode support), and library functions with improved bounds checking. Work continues on technical reports addressing decimal floating point, additional mathematical special functions, and additional dynamic memory allocation functions. The C and C++ standards committees have been collaborating on specifications for threaded programming.

The next revision of the C standard, C11, was ratified in 2011. The C standards committee adopted guidelines that limited the adoption of new features that have not been tested by existing implementations. Much effort went into developing a memory model, in order to clarify sequence points and to support threaded programming.

[edit] See also

[edit] References

  1. ^ "x86 Open64". Developer.amd.com. 1 April 1989. http://developer.amd.com/cpu/open64/onlinehelp/pages/x86_open64_help.htm#Standards. Retrieved 8 June 2009. 
  2. ^ "cc65 - a freeware C compiler for 6502 based systems". http://www.cc65.org/#Features. Retrieved 14 September 2011. 
  3. ^ "C/C++ interpreter Ch C99 features". SoftIntegration, Inc.. 15 February 2008. http://www.softintegration.com/demos/chstandard/c99.html. Retrieved 15 February 2008. 
  4. ^ "Clang Compiler User's Manual". http://clang.llvm.org/docs/UsersManual.html#c. Retrieved 11 January 2010. 
  5. ^ "C Language Implementation - Digital Mars". http://www.digitalmars.com/ctg/C-Language-Implementation.html. Retrieved 14 September 2011. 
  6. ^ "Status of C99 features in GCC". Free Software Foundation, Inc.. 25 April 2011. http://gcc.gnu.org/c99status.html. Retrieved 11 July 2011. 
  7. ^ "Status of C99 features in GCC 4.6". Free Software Foundation, Inc.. 25 April 2011. http://gcc.gnu.org/gcc-4.6/c99status.html. Retrieved 11 July 2011. 
  8. ^ http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=an&subtype=ca&supplier=897&appname=IBMLinkRedirect&letternum=ENUS202-161
  9. ^ http://www-01.ibm.com/software/awdtools/xlcpp/aix/features/
  10. ^ http://www-01.ibm.com/support/docview.wss?uid=swg21408170
  11. ^ http://connect.microsoft.com/VisualStudio/feedback/details/485416/support-c99
  12. ^ http://msdn.microsoft.com/en-us/library/zb1574zs%28v=VS.100%29.aspx
  13. ^ "C99 compliance in Open Watcom". http://www.openwatcom.org/index.php/C99_Compliance. Retrieved 11 March 2009. 
  14. ^ "Sun Studio 12: C Compiler 5.9 Readme". Sun Microsystems, Inc.. 31 May 2007. http://developers.sun.com/sunstudio/documentation/ss12/mr/READMEs/c.html#about. Retrieved 9 January 2008. 
  15. ^ http://bellard.org/tcc/tcc-doc.html#SEC7
  16. ^ http://bellard.org/tcc/

[edit] Further reading

[edit] External links

Preceded by
C89 / C90 / "ANSI C"
C language standards Succeeded by
C11
Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages