cpp compatiblity Unix/VMS

Darin Johnson darin at nova.laic.uucp
Tue Aug 9 05:42:04 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
> 

I wonder why DEC likes to push this format.  Obviously, it is not
clear enough in the C manual that the following are EQUIVALENT!

  #include stdio
and
  #include <stdio.h>

I have all my VMS software using the angle-brackets with absolutely
no problem.  Leaving the brackets off speeds up access by a miniscule
fraction.  I feel this is a serious documentation problem with DECs
C manual.  None of the examples in the manual use the angle brackets,
which is probably why I see so many people with the impression that they
aren't allowed.  So I would change the code above to read:

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

(notice that I have #ifdef VMS instead of #ifdef VAX!)

Also, if you define the logical name SYS to point to SYS$LIBRARY,
then you can also have statements like "#include <sys/file.h>", which
makes for easier porting.

Darin Johnson (...pyramid.arpa!leadsv!laic!darin)
              (...ucbvax!sun!sunncal!leadsv!laic!darin)
	"All aboard the DOOMED express!"



More information about the Comp.lang.c mailing list