mann@intacc.uucp (Jeff Mann) (06/29/89)
When trying to compile /relay/hdrdefs.c under Microport SysV rl2.3, I get this (somewhat confusing to me) error: "hdrdefs.c", line 49: compiler error: expression causes compiler loop: try simplifying line 48 & 49 are: static const struct hdrdef msghdr = { msgnm, STRLEN(msgnm), offsetof(struct headers, h_msgid) }; and offsetof is defined: #define offsetof(type, mem) ((char *)&((type *)NULL)->mem - (char *)NULL) - Any advice? -- | Jeff Mann - Inter/Access, Toronto ...uunet!mnetor!intacc!mann | | "A picture is worth 256 thousand words" {utzoo, utgpu}!chp!intacc!mann |
henry@utzoo.uucp (Henry Spencer) (07/01/89)
In article <1989Jun29.010600.6802@intacc.uucp> mann@intacc.UUCP (Jeff Mann) writes: > "hdrdefs.c", line 49: compiler error: > expression causes compiler loop: try simplifying > >...and offsetof is defined: > >#define offsetof(type, mem) ((char *)&((type *)NULL)->mem - (char *)NULL) > >- Any advice? Well, you might try simplifying offsetof to #define offsetof(type, mem) ((int)&((type *)NULL)->mem) but it's not guaranteed. A complaint to Microport about their defective compiler is probably also a good idea. -- NASA is to spaceflight as the | Henry Spencer at U of Toronto Zoology US government is to freedom. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
" Maynard) (07/02/89)
In article <1989Jun30.204822.2821@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >>#define offsetof(type, mem) ((char *)&((type *)NULL)->mem - (char *)NULL) >Well, you might try simplifying offsetof to >#define offsetof(type, mem) ((int)&((type *)NULL)->mem) Ack!!! Assuming that (char *) == (int) is terrible programming practice. I thought you knew better, Henry. >A complaint to Microport about their defective >compiler is probably also a good idea. We all know that Microport's compiler is buggy as hell. Complaining about it to them is unlikely to help, for two reasons: 1) They effectively are out of business: chapter 11, and nobody answers the phones. 2) They didn't fix it while they were still around, and knew it was buggy. -- Jay Maynard, EMT-P, K5ZC, PP-ASEL | Never ascribe to malice that which can uucp: uunet!nuchat! (eieio)| adequately be explained by stupidity. {killer,bellcore}!texbell!splut!jay +---------------------------------------- internet: jay@splut.conmicro.com | Richard Sexton, proud Texan.
henry@utzoo.uucp (Henry Spencer) (07/03/89)
In article <2722@splut.conmicro.com> jay@splut.conmicro.com (Jay "you ignorant splut!" Maynard) writes: >>Well, you might try simplifying offsetof to >>#define offsetof(type, mem) ((int)&((type *)NULL)->mem) > >Ack!!! Assuming that (char *) == (int) is terrible programming practice. >I thought you knew better, Henry. We're not talking about clean programming practice, we're talking about how to implement offsetof() under a buggy compiler. :-) Note that I didn't say it would work, just that it was worth trying. The fact is, there isn't any clean portable way to implement offsetof(). Assuming that &NULL->foo is going to work isn't really any better. The right solution is an ANSI C implementation, which has to provide offsetof() *somehow*. In the absence of that, one does what one must. -- $10 million equals 18 PM | Henry Spencer at U of Toronto Zoology (Pentagon-Minutes). -Tom Neff | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
rick@pcrat.UUCP (Rick Richardson) (07/03/89)
In article <2722@splut.conmicro.com> jay@splut.conmicro.com (Jay "you ignorant splut!" Maynard) writes: >In article <1989Jun30.204822.2821@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >>Well, you might try simplifying offsetof to >>#define offsetof(type, mem) ((int)&((type *)NULL)->mem) > >Ack!!! Assuming that (char *) == (int) is terrible programming practice. >I thought you knew better, Henry. But it does workaround the bug in the AT&T 286 SGS. I just put a #ifdef iAPX286 around the modified offsetof() definition. > >We all know that Microport's compiler is buggy as hell. This particular bug goes back all the way to AT&T. Its in the Venix/286 LMCC compilation system (a.k.a. 286 SGS), too. -- Rick Richardson | JetRoff "di"-troff to LaserJet Postprocessor|uunet!pcrat!dry2 PC Research,Inc.| Mail: uunet!pcrat!jetroff; For anon uucp do:|for Dhrystone 2 uunet!pcrat!rick| uucp jetroff!~jetuucp/file_list ~nuucp/. |submission forms. jetroff Wk2200-0300,Sa,Su ACU {2400,PEP} 12013898963 "" \d\r\d ogin: jetuucp