cpp compatiblity Unix/VMS

Leo de Wit leo at philmds.UUCP
Sat Aug 6 21:04:32 AEST 1988


In article <134 at iquery.UUCP> matt at iquery.UUCP (Matt Reedy) writes:
>We had a discussion a few months ago about the [in]compatiblity of the
>System V.3 cpp and VMS #include syntax, but I forgot the outcome :^).
>
>The problem is the following:  I want the same source to compile on both
>SysV and VMS, so I use this style:
>
>#ifdef VAX
>#include file
>#include stdio
>#else
>#include <fcntl.h>
>#include <stdio.h>
>#endif
>
>On the VAX, the '#include file' and '#include stdio' syntax is valid and
>references members of a text library.  However, my 3B2 cpp chokes on these
>lines with 'bad include syntax' even though the symbol VAX is NOT DEFINED.
>
>Is there an easy workaround?

Yes, there is.
Change it into:

#include <stdio.h>
#ifdef VAX
#include <file.h>
#else
#include <fcntl.h>
#endif

The files stdio.h and file.h should reside in the directory SYS$LIBRARY,
as should the other standard include files.
(Don't know about text libraries, but I would not use them if they
insisted on such a weird syntax, invoking all kinds of portability
problems).

                    Leo.



More information about the Comp.lang.c mailing list