
3-32
SC100 C Compiler
Using the SC100 C Compiler
3.4.1.2 K&R/PCC mode
When
pcc
mode is specified, the SC100 C compiler accepts the traditional C language defined by
The C
Programming Language
, first edition, by Kernighan and Ritchie (K&R), Prentice-Hall, 1978. This mode
provides almost complete compatibility with the Reiser CPP and Johnson PCC (
pcc
), both widely used as
part of UNIX systems. Since there is no documentation of the exact behavior of those programs, complete
compatibility cannot be guaranteed.
In general, when compiling in
pcc
mode, the compiler attempts to interpret a source program that is valid
to
pcc
in the same way that
pcc
would. However, ANSI features that do not conflict with this behavior are
not disabled.
In some cases where
pcc
allows a highly questionable construct, the compiler accepts it but gives a
warning, where
pcc
would be silent. For example:
0x
, a degenerate hexadecimal number, is accepted as
zero, but a warning is issued.
3.4.1.2.1 K&R/PCC mode preprocessor differences
The following are the preprocessor differences relative to the default standard mode:
When preprocessing output is generated, the line-identifying directives will have the
pcc
form
instead of the ANSI form.
__STDC__
is left undefined.
Comments are deleted entirely (instead of being replaced by one space) in preprocessing output.
Extra spaces are not generated in textual preprocessing output to prevent pasting of adjacent
confusable tokens. As a result, the characters
a/**/b
will be
ab
in preprocessor output.
The first directory searched for include files is the directory containing the file which contains the
#include
instead of the directory which contains the primary source file.
Trigraphs are not recognized.
Macro expansion is implemented differently. Arguments to macros are not macro- expanded before
being inserted into the expansion of the macro. Any macro invocations in the argument text are
expanded when the macro expansion is rescanned. With this method, macro recursion is possible and
is checked for.
Token pasting inside macro expansions is implemented differently. End-of-token markers are not
maintained, so tokens that abut after macro substitution may be parsed as a single token.
Macro parameter names inside character and string constants are recognized and are given
substitutes.
Macro invocations having too many arguments are flagged with a warning rather than an error. The
extra arguments are ignored.
Macro invocations having too few arguments are flagged with a warning rather than an error. A null
string is used as the value of the missing parameters.
Extra occurrences of
#else
(after the first has appeared in an
#if
block) are ignored, with a
warning.