This document gives a brief summary of the major differences between \*n
and
.SC cc .
\*N was designed according to the provisions of
the ANSI Draft Proposed C Standard (X3J11/85-044),
which extends and slightly modifies the language described by
Kernighan and Ritchie in
.I "The C Programming Language" ,
(Prentice-Hall, 1978).
This means that \*n recognizes everything that
.SC cc
does with the few exceptions listed below.
\*N also supports several new additions to the language which are
described in the
.MP ansi
reference manual page.
.SH "Changes to C"
.SS "New Keywords:"
Three keywords have been added to the language.
They are
.KW const ,
.KW signed ,
and
.KW volatile .
Their meaning is explained in the
.MP ansi
manual page.
As with all C keywords, these identifiers are reserved;
they may not be used to name variables, tags, labels, typedefs,
enumeration constants, or members of structures or unions.
.PP
.SS "Static Variables:"
The \*(AN requires that when a static variable is forward referenced,
the storage class
.KW static
must appear in all the declarations for that variable.
The following example is accepted by
.SC cc
but produces a warning in \*n.
@(E
	extern int i ; /** forward reference **/
	int *p = &i ;
	static int i = 1 ; /** definition **/
@)E
However, the proper declaration for \*n is rejected by
.SC cc .
@(E
	static int i ; /** forward reference **/
	int *p = &i ;
	static int i = 1 ; /** definition **/
@)E
.PP
.SS "String Literals:"
\*N treats string literals as read-only data.
If a modifiable array of characters is required,
a variable should be used.
For example:
@(E
	/** Replaces the trailing 'X' with a version number **/
	file_name = "tmpX" ;
	file_name[3] = version ;
@)E
must be rewritten as:
@(E
	static char template[] = "tmpX" ;
	file_name = template ;
	file_name[3] = version ;
@)E
\*N concatenates adjacent string literals into one string.
This is useful for creating long strings without using backslashes.
When a backslash is used, the remaining text must begin at
the beginning of the next line.
@(E
	printf("This is the first sentence in a long string.\en\e
	Using a backslash to continue a string is awkward.\en") ;
@)E
By using string literal concatenation, the program is made more readable.
@(E
	printf("This is the first sentence in a long string.\en"
		   "This string will be appended to the first.\en") ;
@)E
This is new feature which is not supported by
.SC cc .
.PP
.SS "Labels:"
\*N places labels and variables into separate
.ID name
.ID spaces .
This means that a label and a variable with the same name may
be visible at the same time, as in the following example.
@(E
	{
		int error = 0 ;
		...
		if(error) goto error ;
		...
	error: /** Here on an error. **/
		exit(1) ;
	}
@)E
With
.SC cc
the example above will cause a redeclaration error,
since both labels and variables share one set of names.
.PP
.SS "Long int:"
The Draft Standard specifies that
.KW int
and
.KW "long int"
are distinct types.
However
.SC cc
treats
.KW int
and
.KW "long int"
as being identical.
In deference to the compiler,
\*n does the same, even though this contradicts the Draft Standard.
.SH Intentional Bugs
.PP
There are several bugs in
.SC cc
which over the years have crept into a great deal of code
and have become
.I de facto
features.
Most of these bugs have intentionally been reproduced in \*n
to allow greater compatibility with existing code.
.PP
The first two bugs involve lvalues (objects that may be assigned a value).
Many compiler will consider the result of a cast to be an lvalue,
if both the type of the cast and the type of object are integers or pointers
of the same size.
@(E
	int *p ;
	++(int)p ; /* Adds 1 (not 4) to `p' */
@)E
According to the Draft Standard the proper form of the previous
example should be:
@(E
	int *p ;
	++*(int *)&p ; /* Adds 1 (not 4) to `p' */
@)E
The compiler will also allow the result of a conditional expression
to be used as an lvalue, if the expression being tested is a constant.
@(E
	int i, j ;
	((1 > 0) ? i : j) = 3 ; /* Assigns to `i' (not `j') */
@)E
Finally, the compiler allows the semi-colon after the last field declaration
in a tag definition to be omitted.
@(E
	struct s
	{
		int i ;
		double d /* Missing last `;' */
	} ;
@)E
\*N reproduces the compiler's behavior described above.
Warnings are generated when any of the bugs is detected,
but the warnings are suppressed by default.
To have \*N complain about these three bugs,
unsuppress the warnings.
(Refer to Appendix C for a listing of warning and error messages.
Refer to chapter 3 of the
.ED "User's Guide"
or the 
.ED "Reference Manual"
for a description of the
.CO suppress
and
.CO unsuppress
commands.)
.SH Porting
To assist in the few areas where 
.SC cc
and \*n differ, \*n predefines two macros called
.FL __SABER__ ,
and
.FL SABER .
The macro
.FL SABER1_2
is also defined under \*n version 1.2.
