SilverScreen Solid Modeler

Pragmas

Pragmas

Previous topic Next topic  

Pragmas

Previous topic Next topic JavaScript is required for the print function  

SilverCEllipse

 

Pragmas

 

 


The pragmas shown below are supported in the SilverC preprocessor. They are described in the following sections.

 

Pragma Identifier

Meaning

stack

sets run-time execution stack size

sysvar

declares a SilverScreen system variable

debug

controls errno monitoring behavior

monitor

controls function entry/return tracing

symtable

controls compiler symbol table generation

pack

controls compiler structure packing

warnings

controls compiler warning behavior

 


STACK

This pragma allocates run-time stack space, in bytes, for SilverC programs.

 

 #pragma stack <integer constant>

 

 

The minimum size allowed for <integer constant> is 500 bytes; there is no maximum.

The default stack size is 10000 bytes

 

 


SYSVAR

This pragma is used to declare a SilverScreen system variable. See System Variables on page 44 for more information on usage. The statement has the form:

 

 #sysvar <type> <name>

 

where <type> is one of text, value or xyz , and where <name> is the name of a system variable, including the preceding dollar sign ('$'). For example:

 

 #sysvar text $textvar

 #sysvar value $doublevar

 #sysvar xyz $xyzvar

 

 


DEBUG

This pragma is provided to give notice of errors in built-in functions that set errno (the system error variable). If the symtable pragma is also in effect, the name of the user function where the error occurred is included in the message. In addition, if the built-in function that caused the error was a math function (tan , log , etc.), then the name of the function is provided as well.

 

The debug pragma also causes a stack trace to be performed if an execution error occurs (see the stacktrace function).

 

The following two forms enable the debug function:

 

 

 #pragma debug

 #pragma debug on

 

 

The following form disables the debug function:

 

 

 #pragma debug off

 

 


MONITOR

This pragma is provided to give notice of errors in built-in functions that set errno (the system error variable). If the symtable pragma is also in effect, the name of the user function where the error occurred is included in the message. In addition, if the built-in function that caused the error was a math function (tan , log , etc.), then the name of the function is provided as well.

 

This pragma also causes a stack trace to be performed if an execution error occurs (see the stacktrace function).

 

The following two forms enable the debug function:

 

 

 #pragma debug

 #pragma debug on

 

 

The following form disables the debug function:

 

 

 #pragma debug off

 

 

The default for the debug flag is off.

 

 


SYMTABLE

This pragma, when specified, causes the compiler to append a symbol table to the .EX file produced. This symbol table may be used by the run-time module for debugging purposes, particularly in conjunction with the monitor facility (see MONITOR on page 23) and the function stack trace facility (see the run-time library reference entry for stacktrace). The symbol table consists of an entry for each function, one for each parameter in a function, and one for each piece of global data. Each entry is approximately 28 bytes in length.

 

The following forms cause a symbol table to be written to the .EX file:

 

 

 #pragma symtable

 #pragma symtable on

 

 

The following form causes the symbol table to not be written:

 

 

 #pragma symtable off

 

 

By default, no symbol table is written.

 

Note: symbol table generation may also be controlled via the COMPILE OPTIONS command, the COMPILE OPTIONS popup or the SILVERC environment variable. See Configuring the Compiler.

 

 


PACK

This pragma, when specified, sets the current structure-packing alignment. The form used is meant to be similar to #pragma pack as implemented in MC VC++ versions 5 and above.  #pragma pack was implemented to allow developers who use DLLs to ensure that common structures are handled appropriately.

 

Forms:

 

#pragma pack( <n> )

set current alignment value to <n>

#pragma pack()

set current alignment value to default (= 4)

#pragma pack( push, <n> )

push old value, then set current alignment to <n>

#pragma pack( pop, <n> )

pop old value, then set current alignment to <n>

#pragma pack( pop )

pop old value, and use its align value as current

 

Allowable values for <n> are 1, 2, 4, 8, 16. The default packing value for SilverC is 4.

 

 


WARNINGS

This pragma determines how the compiler behaves in the presence of certain questionable program constructs. If warnings are on, then the compiler generates errors for these situations. Otherwise, they are ignored.

 

The following forms cause warning detection to be enabled:

 

 

 #pragma warnings

 #pragma warnings on

 

 

The following form causes warning detection to be disabled:

 

 

 #pragma warnings off

 

 

By default, warnings are not detected by the compiler.

 

Note: warning behavior may also be controlled via the COMPILE OPTIONS command, the COMPILE OPTIONS popup or the SILVERC environment variable. See Configuring the Compiler.