Newsgroups: news.software.b Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: compiler error? Message-ID: <1989Jul2.224422.16947@utzoo.uucp> Organization: U of Toronto Zoology References: <1989Jun29.010600.6802@intacc.uucp> <1989Jun30.204822.2821@utzoo.uucp> <2722@splut.conmicro.com> Date: Sun, 2 Jul 89 22:44:22 GMT 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