ANSI C

Since the appearance of the C programming language in 1972, several variants ( specifications, international standards ) have been published.

  • 3.1 Most important new features of C95
  • 3.2 Präprozessortest on C95 compatibility
  • 4.1 Most important new features of C99
  • 4.2 Präprozessortest on C99 compatibility
  • 5.1 new features of C11

K & R C

With K & R C, the C variant is referred to, as it was originally written by the inventors Brian W. Kernighan and Dennis Ritchie and is described in the first edition of her book The C Programming Language of 1978 ( K & R1).

C89, C90

In 1983 a committee was named X3J11 established to develop a standard for the C programming language by the American National Standards Institute (ANSI). The basis for the language definition was used the C programming language, as conceived by the inventors Brian W. Kernighan and Dennis Ritchie (K & R C).

After six years of work, the standard ANSI X3.159 - 1989 Programming Language C was adopted in December 1989. This version of the C language is called due to their year of publication as C89. A year later, in 1990, this standard was ( with a few minor changes ) of the WG14 ISO as ISO / IEC 9899:1990 ( C90 ) were adopted. The revised second edition of the book The C Programming Language of 1988 ( K & R2) reflects the changes to the language through the standardization process.

Many of the hitherto non-standard features of the language were determines uniform, as well as new language features such as function prototypes, a powerful C preprocessor, and the ability to declare constants were added to the language. The C standard conceded there along with others, ambiguities in the original definition, this includes the execution order of the four increment and decrement operators ( , -). The standard further the scope of the standard library contained has been set.

To date, C90 is the language basis for all further developments of the C programming language, including C , which has facilities for object-oriented and generic programming.

A system based on C90 program should be compiled and run without problems of any C compiler. In practice, this is only partly the case because almost all C derivatives, additional libraries and function prototypes used to access the individual components of the computer system can.

Most important new features of C90

  • The range of functions and the behavior of the standard library functions have been normalized.
  • An improved preprocessor has been introduced.
  • Function prototypes were introduced.
  • Void for empty function parameter declarations and indicates functions with no return value, and void * for a universally compatible pointer type were added newly.
  • The new keywords const, volatile, and signed were introduced.
  • The unused keyword entry has been removed.
  • Support for wide -character (more than 8 bits wide) and for multi-byte character sets was added.

Präprozessortest on C90 compatibility

# if __ STDC__ / *   * C90 -compatible source code.   * / # endif C95

Published in 1995, the ISO expansion - the Amendment 1 - to C standard, then as an ISO / IEC 9899/AMD1: was designated in 1995 ( C95 ). In addition to bug fixes, there were also changes to the language support.

Most important new features of C95

  • Improve the supporting multibyte and wide -character character sets by the standard library.
  • Adding digraphs discussed.
  • Definition of standard macros for alternative spelling of operators, for example, and for &&.
  • Definition of the standard macros __ STDC_VERSION__.

Präprozessortest on C95 compatibility

# if defined ( __STDC_VERSION__ ) && __ STDC_VERSION__ > = 199409L / *   * C95 -compatible source code.   * / # endif C99

In 1995, a committee was established to extend C and to improve again. It evolved in 1999, the new ISO standard ISO / IEC 9899:1999, also known as C99. He replaced the standard ISO / IEC from 9899:1994-09 ( C95 ). For this standard released in 2001 as a Technical Corrigendum 1, 2004, a Technical Corrigendum 2 and 2007, a Technical Corrigendum 3 C99 including these corrections is unofficially referred to as C0X and forms the basis for future C standard.

With some C99 flowed from C known extensions into the C language to declare as inline functions and the ability to set variables inside the for statement.

Most important new features of C99

  • Support of complex numbers by the new data type _Complex and corresponding functions in the standard library.
  • Expansion of the integer data types to a minimum of 64 -bit long long type, as well as types with specified minimum width, int_least8_t and uint_least32_t for example. In addition, integer types are specified with exact width, but referred to as optional - int32_t for example.
  • Local variable size fields.
  • The Boolean data type _Bool. A macro called bool is its own header for him defined.
  • Further improved support for international character sets.
  • Enhanced support for floating-point numbers, including new mathematical functions in the C library.
  • Alias ​​- free pointer ( keyword restrict ).
  • Inline functions ( inline keyword ).
  • Prohibition of "implicit int "; Prohibition of implicit function declarations.
  • Hexadecimal floating-point constants. Input and output in scanf () and printf () via "% a " and "% A".
  • Preprocessor macros with variable number of parameters.
  • Allow the standard C line comment "/ /".

Präprozessortest on C99 compatibility

# if defined ( __STDC_VERSION__ ) && __ STDC_VERSION__ > = 199901L   / / C99 compatible source code. # endif C11

The standardization committee WG14 working on a new edition of the C standard with working title C1X based on the C99 standard, including the Technical corrigenda TC1, TC2 and TC3 ( C0X ). On December 8, 2011 C11 was adopted as ISO / IEC 9899:2011.

New features of C11

The listing is based on various technical reports and the current working document on C1X.

  • Multithreading support ( , )
  • Information about memory alignment of objects ( )
  • Char16_t New data types and char32_t for improved Unicode support, in particular UTF -16 and UTF -32 ( )
  • Changes to the standard library for the testing of field boundaries at runtime of the program in order to avoid, for example, buffer overflows can effectively
  • Support of internal decimal representation of floating point numbers according to IEEE 754-2008
  • Opening files with exclusive Read-Write ( mode "x")
  • Generic expressions ( keyword _Generic ), generic mathematical functions for floating point and complex numbers ( )
  • Gets removal of the library function
  • Some required functionality is optional in C99 compiler manufacturers in C11 again, such as local variable size fields, complex numbers. The functionality can be queried by means of compiler defines __ STDC_NO_COMPLEX__ ( no complex numbers), __ STDC_NO_VLA ( no local variable length fields )

Examples of the difference between different versions of the C language

K & R C:

/ * There is no function prototypes. * / Output (str ) char * str; {      printf ( "% s \ n", str); }   main () {      Output ( "Hello World! ");      return 0; } C90/C95:

# include   / * The argument can not be changed. * / void output (const char * const str) {      printf ( "% s \ n", str); }   main () {      Output ( "Hello World! ");      return 0; } C99:

# include   / / The argument is constant and there is no alias. void output (const char * const restrict str) {      printf ( "% s \ n", str); }   int main (void ) / / the return type must be specified {      Output ( "Hello World! ");      / / " Return 0; " need not be specified. } References

68441
de