Notice! This document is currently in Archived status.
The content of this document may be incorrect or outdated.

Print this article Edit this article

What is ansi C?

What is ANSI C? Purdue Engineering Computer Network
C on UNIX systems tends to come in two flavors: "traditional" and ANSI (the American National Standards Institute).

Traditional C is what you would find in Kernighan & Ritchie's "The C Programming Language", 1st edition. It's been in use for a number of years. Unfortunately, it is not necessarily very consistent from one platform (A "platform" generally refers to a combination of computer hardware, such as a VAX, IBM PC, Sun, or IBM RT, and software, such as Berkeley's version of UNIX.) to another. The language differences tend to be either in subtle behavior under some circumstances, or in which extensions to the original definition of C are available.

In December 1989, a proposed standard was approved by ANSI which provides a more detailed and expanded specification for the language than it has had before; most compilers being produced today should conform to ANSI C rather than to old C, but there are a lot of old compilers around. If you pick up the second edition of K&R, or other recent books on C, this is probably what you will be reading about.

One change added in ANSI C, explicitly for the purpose of letting the programmer recognize an ANSI C implementation and take advantage of some of the new features added to the language, is that "__STDC__" has the value of "1". The idea is that traditional-C compilers won't define "__STDC__", so you can put "#if __STDC__" into your source file, and that'll do all you need.

One thing to be aware of is that the C library routines available also differ from one platform to another.

Last Modified: Dec 19, 2016 11:12 am US/Eastern
Created: May 31, 2007 12:04 pm GMT-4 by admin
JumpURL: