Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Apr 1995 23:10:33 -0700 (PDT)
From:      pete@pelican.com (Pete Carah)
To:        gie@charon.er.usgs.gov
Cc:        current@FreeBSD.org
Subject:   preprocessor conflict in proj.4 (geodesic.h)
Message-ID:  <m0rx7FZ-000K0iC@pelican.com>

next in thread | raw e-mail | index | archive | help
In freebsd (2.1 alpha) I had a serious problem with geodesic.h:

it defines a and f; these are very common preprocessor arguments
for other macros in system libraries.  This causes ctype.h to fail.
since f is a free argument to a bunch of macros, and GEODESIC.FLAT
isn't a valid C identifier...

I can see two ways around this - the easiest is to move the include
of this to after all system include files.  The best is to use
underscores everywhere in either the system includes or your own;
I don't know what the ansi committee has to say about this; my copy
of "? & Steele" is put away and K&R don't get into this kind of detail.

I'm cc'ing this to the freebsd group in case those dummy args should
have underscores.  

The offending define is 
geodesic.h:# define f   GEODESIC.FLAT
----------------------------------------------------------------
and lines in ctype.h:
#if defined(_USE_CTYPE_INLINE_)
static __inline int
__istype(_BSD_RUNE_T_ c, unsigned long f)
{
        if (c < 0)
                c = (unsigned char) c;
        return((((c & _CRMASK) ? ___runetype(c) :
            _CurrentRuneLocale->runetype[c]) & f) ? 1 : 0);
}
-------------------------------------------------------------------

For now I can probably get away with defining _USE_CTYPE_CLIBRARY_
to avoid these definitions.

Jordan, Terry, Garrett?  Is anyone familiar enough with the ANSI
system-include rules to know if we (freebsd) have a problem here?

-- Pete



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0rx7FZ-000K0iC>