cpp compatiblity Unix/VMS
Richard A. O'Keefe
ok at quintus.uucp
Sat Aug 6 06:13:36 AEST 1988
In article <134 at iquery.UUCP> matt at iquery.UUCP (Matt Reedy) writes:
>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
>[V.3 cpp dislikes the first two #includes]
(1) That should be #ifdef vms, not #ifdef VAX. VAXen run 4.?BSD, Ultrix,
and some flavour of System V, as well as VMS.
(2) While
#include stdio
and #include <stdio.h>
do mean different things in VAX-11 C (check the manual) the latter form
_is_ accepted and will work unless you've gone out of your way to break
it. You should be able to convert to
#ifdef vms
#include <file.h>
#include <stdio.h>
#else
#include <fcntl.h>
#include <stdio.h>
#endif
and have it work on both. (We had to do this for quite a lot of files;
what makes it particularly galling is that the vms #includes caused no
trouble in V.2. Sometimes I wonder about AT&T.)
(3) Another possibility is to use some other preprocessor. For example,
stuff your program through the GNU "C Compatible Compiler
Preprocessor (CCCP)", and give the result to AT&T's compiler.
More information about the Comp.lang.c
mailing list