Article View: gnu.gcc.help
Article #52758offsetof macro needed
From: Rory Toma
Date: Wed, 03 Jun 1992 07:00
Date: Wed, 03 Jun 1992 07:00
33 lines
1829 bytes
1829 bytes
I need a macro definition for offsetof in order to compile the latest
cnews. The two definitions suggested by the authors of cnews are these:
#define offsetof(type, mem) ((char *)&((type *)NULL)->mem - (char *)NULL)
#define offsetof(type, mem) ((int)&((type *)NULL)->mem)
However, none work, both producing the identical (failed) result upon
compilation. A description follows:
I am using a Sun 4/110 running SunOS 4.1.1, using gcc 2.1
+ make all CC=gcc COPTS=-O -traditional DBM=
gcc -I../include -I. -DVOID=int -DFLUSHEVERY=6 -O -traditional -target sun4 -c
hdrdefs.c
hdrdefs.c:49: parse error before `struct'
hdrdefs.c:49: `h_msgid' undeclared, outside of functions
*** Error code 1
make: Fatal error: Command failed for target `hdrdefs.o'
+ exit 1
The code that it is choking on looks like the following:
static struct hdrdef msghdr = {
msgnm, STRLEN(msgnm), offsetof(struct headers, h_msgid) };
Any help would be appreciated. Thanks
--
toma@tc.cornell.edu - Rory Toma
Apple & IBM - Bringing us closer to the world of yesterday, only they're
not going to tell us how they did it, and they'll sue anyone who helps!
Technical Details
Message-ID:
<TOMA.92Jun3020027@db.TC.Cornell.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!know!cass.ma02.bull.com!think.com!mips!darwin.sura.net!jvnc.net!rutgers!micro-heart-of-gold.mit.edu!uw-beaver!cornell!batcomputer!tomaShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,a4a20f7b7087df43,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-06-02 21:08:10 PST Path: arc1-ca.pugleaf.net!sparky!uunet!know!cass.ma02.bull.com!think.com!mips!darwin.sura.net!jvnc.net!rutgers!micro-heart-of-gold.mit.edu!uw-beaver!cornell!batcomputer!toma From: toma@db.TC.Cornell.EDU (Rory Toma) Newsgroups: gnu.gcc.help Subject: offsetof macro needed Message-ID: <TOMA.92Jun3020027@db.TC.Cornell.EDU> Date: 3 Jun 92 07:00:27 GMT Sender: news@tc.cornell.edu Distribution: gnu.gcc.help Organization: Not bloody likely around here! Lines: 33 Nntp-Posting-Host: db.tc.cornell.edu