The C programming language, developed in the early 1970s by Dennis Ritchie at Bell Labs, quickly gained popularity due to its efficiency, portability, and flexibility. However, C variations and extensions by different compiler vendors led to compatibility issues. To address this, the American National Standards Institute (ANSI) formed a committee, X3J11, in 1983 to standardize the language and the standard that came out was ANSI C
In this article, we will explore the different features adopted in ANSI C along with the deprecated features. We will also look at the compiler that provides full support to this standard.
ANSI C also referred to as C89, was the first C Programming Language Standard defined by the American National Standards Institute (ANSI) in 1989. It is officially designated as ANSI X3.159-1989. By standardizing the language for use across compilers and platforms, it represents a major landmark in the evolution of C. ANSI C standard was designed to offer consistent and reliable programming environment that can produce code which works with minimal adjustments on different systems.
The standard was later adopted by the International Organization for Standardization (ISO) as ISO/IEC 9899:1990, often referred to as C90.
The ANSI C Standard adopted the main features of the language along with the features popular at that time from the given compilers. Important features include:
Function declarations now include the types of their parameters, enabling the compiler to perform type checking.
int add(int a, int b); // Function prototype
The C standard library of ANSI included a comprehensive set of functions for input/output operations, string manipulation, memory allocation and more, these standardized set of functions made it easier to write portable code. Libraries are written in the form of header files like:
#include #include
There are total of 24 header files in ANSI Standard
ANSI C also introduced the popular and useful data types that were not the part of every compiler version of C. They are
The const and volatile qualifiers were added for variables. Prior to the introduction of type qualifiers such as const and volatile, a better regulation was needed for variable modification as well as optimization.
Direct assignment of structures was allowed. It means that we could assign the structure to another structure just like variables.
Example
struct Point < int x, y; >; struct Point p1 = ; struct Point p2 = p1; // Structure assignment
Macros like __FILE__, __LINE__, and __DATE__ were standardized.
Enhanced support for formatted input/output through functions like printf and scanf and more like sscanf, fprintf, etc.
Functions were standardized for dynamic memory management. They included:
int *ptr = (int *)malloc(sizeof(int) * 10);
The standard provided guidelines to ensure consistent behaviour across different platforms and compilers.
Because the ANSI C had a number of additions, certain features in earlier versions were deprecated or removed so as to make it uniform and more portable:
To improve type checking and to avoid errors that might occur and functions that are called without prior declaration or definition are no longer allowed.
Description : Traditional K&R (Kernighan and Ritchie) style function definitions without type information are now obsolete and replaced by new function prototype syntax.
Example (deprecated):
// Deprecated K&R style int add(a, b) int a, b;
Example (new style)
int add(int a, int b)
return a + b;
>
To enhance its portability and compliance with the standard, non-standard keywords and compiler-specific extensions that were not part of original C language have been abolished.
Many compilers added support for ANSI C/C89 to ensure compliance with the new standard. Some of the notable compilers that supported ANSI C/C89 include:
The introduction of ANSI C/C89 was a critical development in the history of programming languages. By adding new features, standardizing the language, and ensuring wide compiler support, ANSI C/C89 established a solid foundation for writing portable, reliable, and maintainable code. Its influence persists today, as many of the features and conventions introduced in ANSI C continue to shape modern programming practices.