Skip to content Accesskey=4Skip to sub-navigation Accesskey=3View our Accessibility Options MIT Information Systems Home About IS&T Contact IS&T Site Map Search Advanced Search
Getting StartedGetting Services by Topic or Alphabetically Getting Help

On This Page

[Help]

  

Quick Links

Top Level

Related Links

Ask OLC a question

Athena Consulting Homepage

Helpdesk Stock Answers (for Mac/PC questions)


Differences between ANSI C and TRADITIONAL C

C on UNIX systems tends to come in two flavors: "traditional" and ANSI.

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 to
another.  (A "platform" generally refers to a combination of computer
hardware, such as a IBM PC, Sun, or IBM RT, and software, such as
Berkeley's version of UNIX.)  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 (the American
National Standards Institute), 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.

Another thing to be aware of is that the C library routines available also
differ from one platform to another.  The ANSI standard does provide a
standard set of routines, but Athena does not currently have a C library that
conforms completely to this standard, and probably will not have such a
library in the near future.  Many of the more common "standard" routines, such
as the string manipulation routines "strcpy", "strchr", "index", "strlen", and
so forth, and most of the standard I/O routines, do exist in our C library.



last updated: 6/12/95

MIT Home | Getting Started | Getting Services | Getting Help | About IS&T | Accessibility
Ask a technology question or send a comment about this web page.