C99
C99 is a modern dialect of the C programming language. It extends the previous version (C89) to better make use of available computer hardware and to better employ the latest advances in compiler technology.
Some extensions provide more convenient ways of expressing particular algorithm constructs. Others provide better control, for instance for numerical purposes, or for directing optimizations.
History
After the ANSI standardization process, the C language specification remained relatively static for some time, whereas C++ continued to evolve, largely during its own standardization effort. Normative Amendment 1 created a new standard for the C language in 1995, but only to correct some details of the C89 standard and to add more extensive support for international character sets. However, the standard underwent further revision in the late 1990s, leading to the publication of ISO/IEC 9899:1999 in 1999. This standard is commonly referred to as "C99." It was adopted as an ANSI standard in May 2000. The international C standard is maintained by the working group ISO/IEC JTC1/SC22/WG14.
Design
C99 is, for the most part, backward compatible with C90 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 while compiling, assume int
and continue translating the program.
C99 introduced several new features, many of which had already been implemented as extensions in several compilers:
- inline functions
- intermingled declarations and code, variable declaration no longer restricted to file scope or the start of a compound statement (block)
- several new data types, including
long long int
, optional extended integer types, an explicit boolean data type, and acomplex
type to represent complex numbers - variable-length arrays
- support for one-line comments beginning with
//
, as in BCPL or C++ - new library functions, such as
snprintf
- new header files, such as
stdbool.h
andinttypes.h
- type-generic math functions (
tgmath.h
) - improved support for IEEE floating point
- designated initializers
- compound literals
- support for variadic macros (macros of variable arity)
restrict
qualification to allow more aggressive code optimization- universal character names, which allows user variables to contain other characters than the standard character set
Parts of the C99 standard are included in the proposed extensions to the C++ language known as TR1 and C++0x, including integer types, header files and library functions. Variable-length arrays are not among them.
Implementations
Most C compilers now have support for at least some of the features of C99. However, there has been less support from vendors such as Microsoft and Borland that have mainly focused on C++.
GCC, despite its extensive C99 support, is still not a completely compliant implementation (43 features done); as of November 2009[update], 6 of the features are missing or do not work correctly.[1]
The Open Watcom C compiler implements the most-used parts of the standard. However, they are enabled only through an undocumented command-line switch.[2]
According to Sun Microsystems, Sun Studio (which is downloadable without charge) now supports the full C99 standard.[3]
The C interpreter Ch supports major C99 features [4] and it is available without charge in Windows, Linux, Mac OS X, Solaris, QNX and FreeBSD.
The compiler within Pelles C support most C99 features.
Intel C++ compiler supports some of most of the important C99 features.
The free AMD x86 Open64 Compiler Suite has C99 support equal to that of GCC.[5]
The Tiny C Compiler supports most of C99 except complex numbers and variable length arrays.
The Portable C compiler is also working to become C99 compliant.
Clang is C99 compliant, except for the C99 floating-point pragmas.[6]
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.
#if __STDC_VERSION__ >= 199901L
/* "inline" is a keyword */
#else
# define inline /* nothing */
#endif
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.
As of 2007, work has begun in anticipation of another revision of the C standard, informally called "C1X". The C standards committee has adopted guidelines that should limit the adoption of new features that have not been tested by existing implementations.
It is likely that the standard gets
function, which was officially deprecated in response to a defect report concerning its unsafe interface design, will not be specified in the next revision of the C standard.[7]
See also
References
- ↑ "Status of C99 features in GCC". Free Software Foundation, Inc.. 2009-03-29. http://gcc.gnu.org/c99status.html. Retrieved 2009-07-04.
- ↑ "C99 compliance in Open Watcom". http://www.openwatcom.org/index.php/C99_Compliance. Retrieved 2009-03-11.
- ↑ "Sun Studio 12: C Compiler 5.9 Readme". Sun Microsystems, Inc.. 2007-05-31. http://developers.sun.com/sunstudio/documentation/ss12/mr/READMEs/c.html#about. Retrieved 2008-01-09.
- ↑ "C/C++ interpreter Ch C99 features". SoftIntegration, Inc.. 2008-02-15. http://www.softintegration.com/demos/chstandard/c99.html. Retrieved 2008-02-15.
- ↑ "x86 Open64". Developer.amd.com. 1989-04-01. http://developer.amd.com/cpu/open64/onlinehelp/pages/x86_open64_help.htm#Standards. Retrieved 2009-06-08.
- ↑ "Clang Compiler User's Manual". http://clang.llvm.org/docs/UsersManual.html#c. Retrieved 2010-01-11.
- ↑ "Remove
gets()
". Registered document of ISO/IEC JTC1/SC22/WG14. 2009-10-29. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1420.htm.; adopted by the committee as stated in "draft minutes of the October 2009 meeting". http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1422.pdf., item 4.17.
External links
- Draft of the C99 standard with corrigenda TC1, TC2, and TC3 includedPDF (3.61 MB)
- New in C9X
- IBM developerWorks: Open source development using C99
- Kuro5hin: Are you Ready For C99?
bg:C (език за програмиране)#C99 de:C99 fr:C99 ko:C99 ja:C99 pl:C99 ru:C99
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...