Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ User's Guide - the watcom c/c++ preprocessor forms an integral part of watcom c/c++. when http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The Watcom C/C++ preprocessor forms an integral part of Watcom C/C++.  When
any form of the "p" option is specified, only the preprocessor is invoked.
 No code is generated and no object file is produced.  The output of the
preprocessor is written to the standard output file, although it can also be
redirected to a file using the "fo" option.  Suppose the following C/C++
program is contained in the file MSGID.C.

Example:

     #define _IBMPC 0
     #define _IBMPS2 1

     #if _TARGET == _IBMPS2
     char *SysId = { "IBM PS/2" };
     #else
     char *SysId = { "IBM PC" };
     #endif

     /* Return pointer to System Identification */

     char *GetSysId()
       {
         return( SysId );
       }

We can use the Watcom C/C++ preprocessor to generate the C/C++ code that
would actually be compiled by the compiler by issuing the following command.

Example:

     C>compiler_name msgid /plc /fo /d_TARGET=_IBMPS2

The file MSGID.I will be created and will contain the following C/C++ code.


     #line 1 "msgid.c"




     char *SysId = { "IBM PS/2" };
     #line 9 "msgid.c"

     /* Return pointer to System Identification */

     char *GetSysId()
       {
         return( SysId );
       }

Note that the file MSGID.I can be used as input to the compiler.

Example:

     C>compiler_name msgid.i

Since #line directives are present in the file, the compiler can issue error
messages in terms of the original source file line numbers.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson