DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
ANSI implementation-defined behavior

Preprocessing directives

This section describes the implementation-defined characteristics of preprocessing directives. It corresponds to section ``F.3.13 Preprocessing Directives'' in the ANSI document.

Character constants and conditional inclusion

The value of a single-character character constant in a constant expression that controls conditional inclusion matches the value of the same character constant in the execution character set. This may be a negative value.

Locating includable source files

To locate bracketed, includable source files, the preprocessor searches through any paths specified on the command line by the -I option and then through the default path or paths, normally an API-specific hierarchy such as /usr/include/ansi, and /usr/include.

Including files with quoted names

To locate quoted, includable source files, the preprocessor looks in the directory containing the file being compiled, then searches through any paths specified on the command line by the -I option, and then searches through the default path or paths, normally an API-specific hierarchy such as /usr/include/ansi, and /usr/include. If the file is not found, the preprocessor reparses the the ``#include string newline'' as if it was a ``< >'' delimited file and repeats the search as described in the previous section.

Filenames can be any legal UNIX filename including a full specification of paths.

Character sequences

Both source and execution sets include the full ASCII character sets. The delimited sequence is mapped directly into the external filename.

Pragmas

The behavior of each recognized #pragma directive in C is listed below:

asm

   #pragma asm [full_optimization|partial_optimization] asm_func

specifies full or partial optimization for asm_func, which must have an entry in the symbol table and be an asm.

comment

   #pragma comment (compiler)

which is silently ignored,

or

   #pragma comment (comment_type, "string")
where comment_type must be one of exestr, user or lib.

When comment_type is exestr, the string, string, is put in a comment section of the object file. This is equivalent to the previous non-ANSI construction #ident "string". When comment_type is either user or lib, the #pragma statement is silently ignored.

ident

   #pragma ident "version"

which is identical in function to the previous non-ANSI construction #ident "version".

int_to_unsigned

   #pragma int_to_unsigned identifier

which identifies identifier as a function whose type was int in previous releases of the compilation system, but whose type is unsigned int in this release. The declaration for identifier must precede the #pragma.

   unsigned int strlen(const char*);
   #pragma int_to_unsigned strlen
#pragma int_to_unsigned makes it possible for the compiler to identify expressions in which the function's changed type may affect the evaluation of the expression. In the -Xk or -Xt mode, the compiler treats the function as if it were declared to return int rather than unsigned int.

pack

   #pragma pack (n)

which controls the layout of structure offsets. n is a number, 1, 2, or 4, that specifies the strictest alignment desired for any structure member. If n is omitted, the alignment reverts to the default, which may have been set by the -Zp option to cc.

A value of 4 is the default.

weak

   #pragma weak identifier

which identifies identifier as a weak global symbol,

or

   #pragma weak identifier = identifier2

which identifies identifier as a weak global symbol whose value is the same as identifier2. identifier should otherwise be undefined. For more information on weak global symbols, see ``Multiply defined symbols''.

Definitions for date and time

The macros __DATE__ and __TIME__ return the date and time of translation respectively. The date and time are always available to the macros.


Next topic: Library functions
Previous topic: Statements

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003