ANSI C

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

ANSI C, ISO C and Standard C are successive standards for the C programming language published by the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO). Historically, the names referred specifically to the original and best-supported version of the standard (known as C89 or C90). Software developers writing in C are encouraged to conform to the standards, as doing so helps portability between compilers.

History and outlook[edit]

The first standard for C was published by ANSI. Although this document was subsequently adopted by International Organization for Standardization (ISO) and subsequent revisions published by ISO have been adopted by ANSI, "ANSI C" is still used to refer to the standard.[1] While some software developers use the term ISO C, others are standards-body neutral and use Standard C.

C89[edit]

In 1983, the American National Standards Institute formed a committee, X3J11, to establish a standard specification of C. The standard was completed in 1989 and ratified as ANSI X3.159-1989 "Programming Language C." This version of the language is often referred to as "ANSI C". Later on sometimes the label "C89" is used to distinguish it from C90 but using the same labeling method.

C90[edit]

The same standard as C89 was ratified by the International Organization for Standardization as ISO/IEC 9899:1990, with only formatting changes,[2] which is sometimes referred to as C90. Therefore, the terms "C89" and "C90" refer to essentially the same language.

This standard has been withdrawn by both ANSI/INCITS[3] and ISO/IEC.[4]

C95[edit]

In 1995, the ISO published an extension, called Amendment 1, for the ANSI-C standard. Its full name finally was ISO/IEC 9899:1990/AMD1:1995 or nicknamed C95. Aside from error correction there were further changes to the language capabilities,[5][6] such as:

  • Improved multi-byte and wide character support in the standard library, introducing <wchar.h> and <wctype.h> as well as multi-byte I/O
  • Addition of digraphs to the language
  • Specification of standard macros for the alternative specification of operators, e.g. and for &&
  • Specification of the standard macro __STDC_VERSION__

In addition to the amendment, two technical corrigenda were published by ISO for C90:

  • ISO/IEC 9899:1990/Cor 1:1994 TCOR1 in 1994[7]
  • ISO/IEC 9899:1990/Cor 2:1996 in 1996[8]

Preprocessor test for C95 compatibility[edit]

#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L    /* C95 compatible source code. */  #elif defined(__STDC__)  /* C89 compatible source code. */  

No comments:

Post a Comment