Generated by GPT-5-mini| C89 | |
|---|---|
| Name | C89 |
| Other names | ANSI C, ISO C90 (early) |
| Designer | Dennis Ritchie et al. |
| Typing | Static, weak, manifest |
| Paradigm | Procedural, structured |
| First appeared | 1989 |
| Influenced by | B (programming language), ALGOL 68, BCPL |
| Influenced | C99, C11, C23, Objective-C, C++ |
| Filename extensions | .c, .h |
C89
C89 is the widely referenced 1989 revision of the C standard ratified by the American National Standards Institute following work at Bell Labs under Dennis Ritchie. It established a formal specification for syntax, semantics, preprocessing, translation phases, and the standard library that united prior implementations such as the Portable C Compiler and vendors like AT&T and Microsoft around a common baseline. C89 served as the foundation for later international standardization and influenced successor languages and standards, including C99 and ISO/IEC 9899:1990.
C89 codified language elements such as lexical grammar, declaration syntax, expression semantics, control flow constructs, and type conversion rules for identifiers, operators, and storage durations. The standard defined primitive types including char, int, short int, long int, signed char, and unsigned int along with derived types such as pointers, arrays, functions, and aggregates. It specified the behavior of function declarations, function definitions, and linkage, alongside constraints on translation units and the preprocessor directives inherited from historic implementations like the Portable C Compiler lineage. The standard library specified input/output, string manipulation, memory allocation, and character classification interfaces consistent with implementations from vendors like Digital Equipment Corporation and Sun Microsystems.
Work toward C89 began as ANSI formed the X3J11 committee to resolve dialect differences among implementations such as those at Bell Labs, Microsoft Corporation, Sun Microsystems, AT&T, and implementations derived from UNIX System V. The committee incorporated language features from influential sources including the K&R C second edition by Brian Kernighan and Dennis Ritchie, while addressing portability issues faced in environments like VAX/VMS, IBM PC, and UNIX System III. In 1989 the ANSI standard was approved, then adopted by International Organization for Standardization as ISO/IEC 9899:1990 following liaison between ANSI and ISO groups. C89’s ratification resolved incompatibilities among compilers produced by companies such as Borland and Watcom and academic implementations at institutions like University of California, Berkeley.
C89 specified core constructs including block structure, lexical scoping, and the typedef mechanism, as well as the rules for implicit function declarations and default argument promotions for variadic functions such as printf and scanf. It introduced signedness rules, integer promotions, pointer arithmetic semantics, and sequence point definitions that governed evaluation order in expressions involving operators like ++ and --. The standard specified storage-class specifiers such as extern, static, auto, and register and formalized linkage conventions used across object file formats like ELF and COFF. Function prototypes were standardized to improve type checking, reducing errors prevalent in pre-standard codebases maintained at organizations like NASA and Bell Labs.
C89 defined a standard library with headers including stdio.h, stdlib.h, string.h, math.h, ctype.h, time.h, limits.h, and float.h that provided APIs for formatted I/O, dynamic memory management, string operations, mathematical functions, character classification, and time utilities. The standard mandated behavior for functions such as malloc, free, memcpy, fopen, fclose, fread, and fwrite, establishing expectations used in systems software produced by vendors like IBM and Microsoft. Locale and wide-character support were limited compared to later standards; nonetheless, facilities like setlocale and localeconv were introduced to support internationalized programs used in environments at institutions such as European Organization for Nuclear Research and Siemens.
Following ANSI approval, commercial and academic compilers implemented the C89 specification, including those from GCC’s precursor projects, Microsoft Visual C++, Borland C++, and Sun Studio. Conformance testing was addressed through test suites developed by organizations such as X/Open and vendor consortia, while compiler flags like -std=c89 and -ansi later became common in toolchains including GCC and Clang to select standard-conforming behavior. The standard left certain behaviors undefined or implementation-defined—linkage, endianness, and object representation details—so compiler vendors documented platform specifics for targets like Intel 80386, Motorola 68000, and ARM processors.
C89’s influence persisted in codebases at enterprises and projects such as GNU Project, BSD, Linux kernel early components, and embedded systems developed by Siemens and Intel suppliers. Legacy issues arose from differences between pre-standard dialects and later standards like C99, including support for inline functions, variable-length arrays, and // single-line comments standardized later in C99. Porting efforts between C89 and newer standards required attention to features such as long long integers, mixed declarations and code, and headers like stdint.h introduced in later revisions. Compatibility remains a concern for toolchains targeting constrained platforms and historical systems such as VAX and MS-DOS, where vendors provided backward-compatible extensions that exceeded C89’s scoped guarantees.
Category:C programming language standards