You copied the Doc URL to your clipboard.

New language features of C99

The 1999 C99 standard introduces several new language features.

These new features include:

  • Some features similar to extensions to C90 offered in the GNU compiler, for example, macros with a variable number of arguments.

    Note The implementations of extensions to C90 in the GNU compiler are not always compatible with the implementations of similar features in C99.
  • Some features available in C++, such as // comments and the ability to mix declarations and statements.

  • Some entirely new features, for example complex numbers, restricted pointers and designated initializers.

  • New keywords and identifiers.

  • Extended syntax for the existing C90 language.

A selection of new features in C99 that might be of interest to developers using them for the first time are documented.

Note C90 is compatible with Standard C++ in the sense that the language specified by the standard is a subset of C++, except for a few special cases. New features in the C99 standard mean that C99 is no longer compatible with C++ in this sense.

Some examples of special cases where the language specified by the C90 standard is not a subset of C++ include support for // comments and merging of the typedef and structure tag namespaces. For example, in C90 the following code expands to x = a / b - c; because /* hello world */ is deleted, but in C++ and C99 it expands to x = a - c; because everything from // to the end of the first line is deleted:

x = a //* hello world */ b 
    - c;

The following code demonstrates how typedef and the structure tag are treated differently between C (90 and 99) and C++ because of their merged namespaces:

typedef int a;
  struct a { int x, y; };
  printf("%d\n", sizeof(a));

In C 90 and C99, this code defines two types with separate names whereby a is a typedef for int and struct a is a structure type containing two integer data types. sizeof(a) evaluates to sizeof(int).

In C++, a structure type can be addressed using only its tag. This means that when the definition of struct a is in scope, the name a used on its own refers to the structure type rather than the typedef, so in C++ sizeof(a) is greater than sizeof(int).