cpp compatiblity Unix/VMS
Paul Lew
lew at gsg.UUCP
Sat Aug 13 01:06:09 AEST 1988
>From article <792 at cernvax.UUCP>, by hjm at cernvax.UUCP (hjm):
>
> #include foobar
> #include <foobar.h>
>
> are not the same if foobar is a logical name! Using logical
> names allows for greater flexibility in where include files are
> kept (you may not want them kept with all the others because of a
> name conflict, or perhaps you just want to be tidy), whereas the
> <foobar.h> form is an absolute address.
>
Is there a version of cpp that will use Unix environment variables for
include file names? This is something I like to have for a long time.
The imake utility ditributed with X11 uses cpp symbols as the include
file names. You may do something like:
#ifdef vms
#else
#define foobar <foobar>
#endif
#include foobar
This works for BSD, 3B2, and Xenix systems. I like it because you can
do things like:
#ifdef BSD
#define String_h <strings.h>
#else
#define String_h <string.h>
#endif
and put all these in one file. There is no need to do #ifdef in every
C files!! However, this works only if there is one to one mapping of
the inlcude file which unfortunately is not true for a lot of them. Any
remedy?
--
Paul Lew {oliveb,harvard,decvax}!gsg!lew (UUCP)
General Systems Group, 5 Manor Parkway, Salem, NH 03079 (603) 893-1000
More information about the Comp.lang.c
mailing list