C99
Encyclopedia
C99 is a modern dialect of the C programming language. 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.

History

After ANSI
Ansi
Ansi is a village in Kaarma Parish, Saare County, on the island of Saaremaa, Estonia....

 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++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 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
Working group
A working group is an interdisciplinary collaboration of researchers working on new research activities that would be difficult to develop under traditional funding mechanisms . The lifespan of the WG can last anywhere between a few months and several years...

 ISO/IEC JTC1/SC22
SC22
SC22, or to give it its full title ISO/IEC JTC1/SC22 Programming languages, their environments and system software interfaces, is the international standardization subcommittee for programming languages, their environments and system software interfaces...

/WG14.

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:
  • inline function
    Inline function
    In various versions of the C and C++ programming languages, an inline function is a function upon which the compiler has been requested to perform inline expansion...

    s
  • intermingled declarations and code: variable
    Variable (programming)
    In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...

     declaration is no longer restricted to file scope or the start of a compound statement (block)
  • several new data type
    Data type
    In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...

    s, including long long int, optional extended integer types, an explicit boolean data type
    Boolean datatype
    In computer science, the Boolean or logical data type is a data type, having two values , intended to represent the truth values of logic and Boolean algebra...

    , and a complex type to represent complex number
    Complex number
    A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

    s
  • variable-length array
    Variable-length array
    In programming, a variable-length array is an array data structure of automatic storage duration whose length is determined at run time ....

    s
  • support for one-line comments beginning with //, as in BCPL
    BCPL
    BCPL is a procedural, imperative, and structured computer programming language designed by Martin Richards of the University of Cambridge in 1966.- Design :...

     or C++
    C++
    C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

  • new library functions, such as snprintf
  • new header file
    Header file
    Some programming languages use header files. These files allow programmers to separate certain elements of a program's source code into reusable files. Header files commonly contain forward declarations of classes, subroutines, variables, and other identifiers...

    s, such as stdbool.h, complex.h, and inttypes.h
  • type-generic math functions (tgmath.h)
  • improved support for IEEE floating point
  • designated initializers
  • compound literals
  • support for variadic macro
    Variadic macro
    A variadic macro is a feature of the C preprocessor whereby a macro may be declared to accept a varying number of arguments.Variable-argument macros were introduced in the ISO/IEC 9899:1999 revision of the C programming language standard in 1999...

    s (macros with a variable number of arguments)
  • restrict
    Restrict
    In the C programming language, as of the C99 standard, restrict is a keyword that can be used in pointer declarations. The restrict keyword is a declaration of intent given by the programmer to the compiler. It says that for the lifetime of the pointer, only it or a value directly derived from it ...

    qualification allows more aggressive code optimization
    Optimization (computer science)
    In computer science, program optimization or software optimization is the process of modifying a software system to make some aspect of it work more efficiently or use fewer resources...

  • 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 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
Standard Template Library
The Standard Template Library is a C++ software library which later evolved into the C++ Standard Library. It provides four components called algorithms, containers, functors, and iterators. More specifically, the C++ Standard Library is based on the STL published by SGI. Both include some...

 already includes similar functionality.

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
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

 that have mainly focused on C++.
Implementation Level of support Details
AMD x86 Open64 Compiler Suite Has C99 support equal to that of GCC.
cc65
Cc65
-External links:***...

Full C89
C89
C89 may refer to:* C89 , a C programming language version* Ruy Lopez chess openings ECO code* HMNZS Royalist , a 1942 New Zealand Royal navy cruiser* KNHC, a radio station in Seattle, Washington known as C89.5...

 and C99 support is not implemented, partly due to platform limitations (MOS Technology 6502
MOS Technology 6502
The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured microprocessor on the market by a considerable margin, costing less than one-sixth the price of...

). There is no support planned for some C99 types like _Complex and 64-bit integers (long long).
Ch Supports major C99 features.
Clang
Clang
Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages. It uses the Low Level Virtual Machine as its back end, and Clang has been part of LLVM releases since LLVM 2.6....

Does not support C99 floating-point pragmas.
C++ Builder
C++ Builder
C++Builder is a rapid application development environment, developed by Borland and owned by Embarcadero Technologies, for writing programs in the C++ programming language. C++Builder combines the Visual Component Library and IDE written in Delphi with a C++ compiler...


Digital Mars C/C++ Compiler Lacks support for some features, such as tgmath.h and _Pragma.
GCC
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

in mainline GCC, 43 features have been completely implemented (12 suffer library issues), 1 feature is broken and 6 are missing. The latest stable release, GCC 4.6, also provides the same level of compliance.
IBM C for AIX, V6 and XL C/C++ V11.1 for AIX
IBM Rational logiscope Until Logiscope 6.3, only basic constructs of C99 were supported. C99 is officially supported in Logiscope 6.4 and later versions.
The Portland Group PGI C/C++
Intel C++ compiler
Intel C++ Compiler
Intel C++ Compiler is a group of C and C++ compilers from Intel Corporation available for GNU/Linux, Mac OS X, and Microsoft Windows....

Microsoft Visual C++ As of Visual C++
Visual C++
Microsoft Visual C++ is a commercial , integrated development environment product from Microsoft for the C, C++, and C++/CLI programming languages...

 2010, there are no plans to support C99.
Open Watcom Implements the most-used parts of the standard. However, they are enabled only through an undocumented command-line switch.
Pelles C
Pelles C
Pelles C is a lightweight freeware integrated development environment for Windows and Pocket PC programming in the C language built and maintained by Pelle Orinius, featuring:* Integrated source code editor with Win32 API call tips, and auto indenting....

Supports most C99 features.
Portable C compiler
Portable C Compiler
The Portable C Compiler is an early compiler for the C programming language written by Stephen C...

Working towards becoming C99-compliant.
Sun Studio
Sun Studio (software)
The Oracle Solaris Studio compiler suite is Oracle's flagship software development product for Solaris and Linux. It was formerly known as Sun Studio...

Tiny C Compiler
Tiny C Compiler
The Tiny C Compiler is an x86 and x86-64 C compiler created by Fabrice Bellard. It is designed to work for slow computers with little disk space . Windows operating system support has been added in version 0.9.23...

Does not support complex numbers or variable length arrays. The developers state that "TCC is heading toward full ISOC99 compliance".


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.)
  1. if __STDC_VERSION__ >= 199901L

/* "inline" is a keyword */
  1. else
  2. define inline static
  3. 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
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

 support), and library functions with improved bounds checking
Bounds checking
In computer programming, bounds checking is any method of detecting whether a variable is within some bounds before its use. It is particularly relevant to a variable used as an index into an array to ensure its value lies within the bounds of the array...

. Work continues on technical reports addressing decimal floating point
Floating point
In computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16...

, additional mathematical special functions
Special functions
Special functions are particular mathematical functions which have more or less established names and notations due to their importance in mathematical analysis, functional analysis, physics, or other applications....

, and additional dynamic memory allocation functions. The C and C++ standards committees have been collaborating on specifications for threaded programming.

Another revision of the C standard, informally called "C1X
C1X
C1X is the unofficial name of the planned new standard for the C programming language. It is intended to replace the existing C standard, informally known as C99. This new version mainly standardizes features that have already been supported by common contemporary compilers, and includes a detailed...

", has been drafted and is expected to be 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
Memory model (computing)
In computing, a memory model describes the interactions of threads through memory and specifies the assumptions the compiler is allowed to make when generating code for segmented memory or paged memory platforms.-History and significance:...

, in order to clarify sequence point
Sequence point
A sequence point in imperative programming defines any point in a computer program's execution at which it is guaranteed that all side effects of previous evaluations will have been performed, and no side effects from subsequent evaluations have yet been performed...

s and to support threaded programming.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK