Implementation Issues

Implementation Issues

Implementation Issues

Implementation Issues

Bugs and Limitations

Incomplete array types (that is, array declarations with the first dimension missing) may be initialized only if they have static storage class -- the initialization 'completes' the declaration by providing the missing dimension. The implication is that all arrays with auto storage class (local and non-static) must have all their dimensions defined in their declarations.

Enumerated types are not distinct; that is, if etype1 and etype2 are enumerated types, then variables of type etype1 and etype2 may be assigned values of any if int , etype1 or etype2 without complaint. This is contrary to the Standard.

i[j[A]] is not handled correctly (for i , j integers, A an array or pointer).

double (*tm)[4] cannot be handled correctly by the parser, nor any declaration with parentheses surrounding the identifier.

Separate compilation of source files is not supported. The successful compilation of a single source file results in a single executable file -- no linking step is available. In order to simulate separate compilation, the #include facility may be used.

maximum size of parameter area for functions with a variable argument list: 128 bytes

the default stack size is 10000 bytes

the maximum number of dimensions on an array is 3; the maximum size of any of those dimensions is 1024

Extensions

A number of variables are predefined by the compiler, similar to the predefined library functions. See Predefined Variables on page 93. These variables may not appear as the target of an assignment statement, nor may their address be taken.

SilverC supports an intrinsic data type, struct _xyz , which is intended to hold 3D coordinates. Variables of this type receive special treatment when embedded in script commands. See XYZ Coordinates on page 35. The structure is defined as follows:

struct _xyz

{

double x;

double y;

double z;

};

If the SilverC compiler encounters an '@' character where it is expecting a statement, the compiler takes the remaining characters in the line to be an embedded SilverScreen script command. Such a command may include embedded C language expressions, provided that these expressions are enclosed with braces. At execution time, expressions are evaluated, inserted into the script command, and passed to the SilverScreen command processor. See Embedded Commands and Expressions on page 33.

The compiler accepts C++ style comments: the characters '//' introduce a comment that extends to the end of the current source line.

A new format specifier has been added to the printf family (printf , fprintf , sprintf , ss_command , vsprintf , vprintf , vfprintf). If 'z' is used as the format specifier, a pointer to the predefined struct _xyz (SS_XYZ) is expected as an argument. The x , y and z components of the SS_XYZ will be converted into an ASCII sequence as if by if by use of "%.15g,%.15g,%.15g".

SilverC variables are significant to 20 characters. SilverScreen system variables are limited to eight characters in length, not including the preceding dollar sign ('$').

Features that are not supported:

pointers to functions

bit fields

extern variables

unsigned attribute

float data type

Arrays may have a maximum of 3 dimensions, up to 1023 elements per dimension.

Data Types and Alignment

In SilverC, the sizes of the elementary data types are:

Data Type

Size

Alignment

char

1 byte

1

short

2 bytes

2

int

4 bytes

4

long

4 bytes

4

double

8 bytes

4

pointer

4 bytes

4

These sizes are independent of operating system and machine.

Structures are aligned according to data type, with padding inserted so that each elementary data type falls on its natural alignment boundary as shown above. In this manner, char is aligned to a 1-byte boundary, short to a 2-byte boundary, int to a 4-byte boundary, and so on.

The internal structures of SilverScreen are designed so that no padding takes place. This is to say that padding has been explicitly inserted into structures where the variables in the structure would otherwise not fall on their natural boundaries. This is the source of some of the unused variables that appear in these structures.