From WikiChip
Difference between revisions of "c/c89"
< c

m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{C standards}}
+
{{c title|C89}}{{C standards}}
 
'''C89''' (aka '''C90'''), sometimes incorrectly referred to as ANSI C, is the first standard for the [[C programming language]] ratified in 1989 as ''ANSI X3.159-1989''. The ''C90'' refers to the same standard as ratified by the International Organization for Standardization a year later, known as ''ISO/IEC 9899:1990''. Note that the C90 standard is the same as the C89 one with only changes in the formatting and section numbering.
 
'''C89''' (aka '''C90'''), sometimes incorrectly referred to as ANSI C, is the first standard for the [[C programming language]] ratified in 1989 as ''ANSI X3.159-1989''. The ''C90'' refers to the same standard as ratified by the International Organization for Standardization a year later, known as ''ISO/IEC 9899:1990''. Note that the C90 standard is the same as the C89 one with only changes in the formatting and section numbering.
  
Line 8: Line 8:
  
 
== Version detection ==
 
== Version detection ==
C89 introduced the <code>__STDC__</code> [[Standard predefined macros - C|predefined macro]] to detect standard C compilers. C90 also introduced the <code>__STDC_VERSION__</code> macro.
+
C89 introduced the <code>__STDC__</code> {{C|Standard predefined macros|predefined macro}} to detect standard C compilers. C90 also introduced the <code>__STDC_VERSION__</code> macro.
  
 
<source lang="C">
 
<source lang="C">

Latest revision as of 08:18, 4 January 2015

C Standards

Standard Revisions

Technical Reports

Other

v · d · e

C89 (aka C90), sometimes incorrectly referred to as ANSI C, is the first standard for the C programming language ratified in 1989 as ANSI X3.159-1989. The C90 refers to the same standard as ratified by the International Organization for Standardization a year later, known as ISO/IEC 9899:1990. Note that the C90 standard is the same as the C89 one with only changes in the formatting and section numbering.

Both ANSI and ISO withdrawn this standard in favor of the C99 version, which was later obsoleted by C11.

History[edit]

For a long period of time, the only authoritative reference to the C programming language was the The C Programming Language book, written by Brian W. Kernighan and Dennis M. Ritchie. The American National Standards Institute formed the X3J11 committee in 1983. The committee was charted to produce a formal specification for the C programming language. In 1989, ANSI completed the standard and ratified it as ANSI X3.159-1989, also known as C89. The following year ISO ratified the very same standard, with a few formatting and section renumbering. The ISO version of the standard is known as C90. In 1994 an amendment, commonly known as Normative Addendum 1 to the C89 standard was added.

Version detection[edit]

C89 introduced the __STDC__ predefined macro to detect standard C compilers. C90 also introduced the __STDC_VERSION__ macro.

#if __STDC__
    /* C89 */
    #if __STDC_VERSION__
        /* C90 */
    #end
#endif

Compiler support[edit]

Support for C89 is almost universal. Any program conforming to the C89 standard should compile and work exactly the same on virtually any platform with a conforming C89 implementation. Because any later version of the C standard is almost completely backwards compatible with earlier versions, a C89 conforming program should also generally be forward compatible.

C89 Compiler Support
Compiler Name Support Level Enforcement Switch Note
ACK Complete
Clang Complete -std=c89
GCC Complete -std=c89[1]
TCC Complete No option to enforce; will compile C99 as well
ICC Complete -std=c89[2]
Visual C++ Complete /Za[3] Can be set by setting Disable Language Extensions to true.

References[edit]

External links[edit]