Path: utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!bionet!ames!pacbell!hoptoad!peora!rtmvax!tarpit!rd From: rd@tarpit.uucp (Bob Thrush x210) Newsgroups: news.software.b Subject: Re: C news on System V/AT (fix) Message-ID: <1989Jul15.150556.2080@tarpit.uucp> Date: 15 Jul 89 15:05:56 GMT References: <583@axis.fr> <1989Jul13.154431.28974@utzoo.uucp> Reply-To: rd@tarpit.UUCP (Bob Thrush x210) Organization: Automation Intelligence,Inc; Orlando,FL Lines: 42 In article <1989Jul13.154431.28974@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >In article <583@axis.fr> philip@axis.fr (Philip Peake) writes: >>...complaints from the compiler, about too complex expressions. >>The problem is the offset() macro, which calculates the offset of a structure >>member *at compile time*... >Alas, quite a few people have reported trouble with this one. From earlier suggestions by Henry and Rick Richardson, the following patch works around the offsetof macro problem. (I have only tested this with the large model.) *** /tmp/hdrdefs.c Sat Jul 15 10:55:17 1989 --- hdrdefs.c Sun Jul 2 13:37:02 1989 *************** *** 17,28 **** #include "hdrint.h" /* may define "const" */ #ifndef offsetof - #ifdef iAPX286 - #define offsetof(type, mem) ((int)&((type *)NULL)->mem) - #else #define offsetof(type, mem) ((char *)&((type *)NULL)->mem - (char *)NULL) ! #endif /* iAPX286 */ ! #endif /* offsetof */ /* "mandatory" headers (also From:, Date:) */ static const char msgnm[] = "Message-ID:"; /* for rejection */ --- 17,24 ---- #include "hdrint.h" /* may define "const" */ #ifndef offsetof #define offsetof(type, mem) ((char *)&((type *)NULL)->mem - (char *)NULL) ! #endif /* "mandatory" headers (also From:, Date:) */ static const char msgnm[] = "Message-ID:"; /* for rejection */ >-- >$10 million equals 18 PM | Henry Spencer at U of Toronto Zoology >(Pentagon-Minutes). -Tom Neff | uunet!attcan!utzoo!henry henry@zoo.toronto.edu -- Bob Thrush UUCP: {ucf-cs,rtmvax}!tarpit!rd Automation Intelligence, 1200 W. Colonial Drive, Orlando, Florida 32804