Previous Table of Contents Next


3.3 Preprocessing

   OMG IDL is preprocessed according to the specification of the preprocessor in “International Organization for Standardization. 1998. ISO/IEC 14882 Standard for the C++ Programming Language. Geneva: International Organization for Standardization.? The preprocessor may be implemented as a separate process or built into the IDL compiler.

   Lines beginning with # (also called “directives?) communicate with this preprocessor. White space may appear before the #. These lines have syntax independent of the rest of OMG IDL; they may appear anywhere and have effects that last (independent of the OMG IDL scoping rules) until the end of the translation unit. The textual location of OMG IDL-specific pragmas may be semantically constrained.

   A preprocessing directive (or any line) may be continued on the next line in a source file by placing a backslash character (“\?), immediately before the newline at the end of the line to be continued. The preprocessor effects the continuation by deleting the backslash and the newline before the input sequence is divided into tokens. A backslash character may not be the last character in a source file.

    A preprocessing token is an OMG IDL token (see Section 3.2.1, “Tokens,? on page 3-6), a file name as in a #include directive, or any single character other than white space that does not match another preprocessing token.

   The primary use of the preprocessing facilities is to include definitions from other OMG IDL specifications. Text in files included with a #include directive is treated as if it appeared in the including file, except that RepositoryId related pragmas are handled in a special way. The special handling of these pragmas is described in Section 10.7, “RepositoryIds,? on page 10-64.

   Note that whether a particular IDL compiler generates code for included files is an implementation-specific issue. To support separate compilation, IDL compilers may not generate code for included files, or do so only if explicitly instructed.