Go backward to Using the C-- Complier
Go up to Top
Go forward to The Inline Statement

The language accepted by c--

The most significant differences between C and the language accepted by c-- involve the overall structure of the declarations and definitions that comprise a program. First, c-- does not support separate compilation. Second, c--'s scope rules for external variables allow forward references. In other words, the scope of an external declaration is the entire program, not just those parts of the source code that appear after the declaration. Finally, since the C- compiler was written slightly before the dawn of time (i.e. 1987), it requires the use of a syntax for function headers that was revised with the adoption of ANSI C.

The first two unusual features of c-- make the distinction between declarations and definitions in C unnecessary. There is no need to declare functions before they are defined since forward references are allowed. Thus, while in C it is common to place a function declaration such as:

double pop();
at the beginning of a source file so that the function described can be referenced before it is defined, c-- does not support such function declarations. In a c-- source file every function header must be immediately followed by the appropriate function body. Similarly, multiple declarations of external variables are not allowed.

The old style of function declarations that c-- uses requires that the types of function parameters be included in separate, variable-like declarations after a function's header line rather than with the parameter names in the header. Thus, a function that would be declared as

int searchforchar( char *source, char key, int occurrence)
{
...
}
using the current C syntax must be declared as
int searchforchar( source, key, occurrence)
char *source;
char key;
int occurrence;
{
...
}
when using c--.

There are several other less significant differences between C declarations and the declarations that c-- will accept. None of the "storage class specifiers" that may be included in C declarations are supported by c--. These include auto, static, extern, register and typedef. Another limitation is that c-- does not support initializers in declarations. Finally, while c-- does support all the structured types of C including arrays, structures and unions, bit-field components are not allowed within structures.

The set of scalar types supported by c-- is simpler than that normally included in C. Only two scalar types are recognized: int and char. Values of both types are stored in 16 bit words (the only unit of storage provided by the WC34000).

c-- supports all of the usual types of expressions found in C, including all of the usual unary and binary operators, subscripting, component selection, pointer dereferencing, type castes and the sizeof pseudo-function. With the exception of the switch statement and the goto statement, all of the usual C statement types are also recognized.



Prev Up Next