5. The Language

5.1. The Syntax

The syntax defined in the Standard is a superset of the one defined in K&R [9]. It follows that if one restricts oneself to the former, there should be no problems with an ANSI C-compliant compiler with respect to syntax. The semantics are, however, another problem altogether and is covered superficially in the next section.

The Standard extends the syntax with the following:

  1. The inclusion of the keywords const, enum, signed, void, and volatile.

  2. The inclusion of additional constant suffixes to indicate their type.

  3. The ellipsis ("...") notation to indicate a variable number of arguments.

  4. Function prototypes.

  5. Trigraph notation for specifying otherwise-unobtainable characters in restricted character sets.

We encourage the use of the reserved words const and volatile since they aid in documenting the code. It is useful to add the following to one's header files if the code must be compiled by a non-conforming compiler as well:

#ifndef __STDC__
#  define const
#  define volatile
#endif

However, one must then make sure that the behavior of the application does not depend on the presence of such keywords. (Evidently, programs that contain identifiers with those names must be modified to conform to the Standard.)

The trigraph notation can bring unexpected results when a program is compiled by an ANSI-compliant compiler, e.g., strings such as "??!" will produce "|". Watch out!

5.2. The Semantics

The syntax does not pose any problem with regard to interpretation because it can be defined precisely. However, programming languages are always described using a natural language, e.g., English, and this can lead to different interpretations of the same text.

Evidently, K&R [9] does not provide an unambiguous definition of the C language otherwise there would have been no need for a standard. Although the Standard is much more precise, there is still room for different interpretations in situations such as f(p=&a, p=&b, p=&c). Does this mean f(&a,&b,&c) or f(&c,&c,&c)? Even "simple" cases such as a[i] = b[i++] are compiler-dependent [1].

As stated in the Introduction, we would like to exclude such topics. The reader is instead directed to the Usenet newsgroups comp.std.c or comp.lang.c where such discussions take place and from where the above example was taken. The Journal of C Language Translation (7) could, perhaps, be a good reference. Another possibility is to obtain a clarification from the Standards Committee and the address is:

	X3 Secretariat, CBEMA
	311 1st St NW Ste 500
	Washington DC, USA

Finally, we mention that a complete list of the differences between "ordinary" C and ANSI C can be found in the Second Edition of K&R [10]. A slightly less up-to-date list can also be found in C: A Reference Manual [5].


7. Address is 2051, Swans Neck Way, Reston, Virginia 22091, USA.


upcontents previousPreprocessors nextUnix Flavors: System V and BSD