Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcnc!rti-sel!dg_rtp!meissner From: meissner@dg_rtp.UUCP (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: zero length array Message-ID: <1287@dg_rtp.UUCP> Date: Fri, 6-Mar-87 13:46:24 EST Article-I.D.: dg_rtp.1287 Posted: Fri Mar 6 13:46:24 1987 Date-Received: Sun, 8-Mar-87 06:32:26 EST References: <4498@brl-adm.ARPA> <1987Feb25.201816.29714@gpu.utcs.toronto.edu> Reply-To: meissner@dg_rtp.UUCP (Michael Meissner) Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 24 In article <1987Feb25.201816.29714@gpu.utcs.toronto.edu> woods@gpu.utcs.UUCP (Greg Woods) writes: > In article <4498@brl-adm.ARPA> Dizio@udel.edu writes: > > Is the following a portable way of finding out where a field > >within a structure is located? > > > > & (((struct any_struct_tag *) 0)->any_field) > > Not that I know of, though the expression without "&" is usefull in sizeof(). > > Some compilers will refuse to cast NULL, specifically Lattice C up to 2.15(?) > As far as I know all Unix compilers will cast NULL. > > You might want to cast one(1) instead. Lattice will accept this. > > Greg Woods. I believe the harris compiler also has problems with this. Also any implementation which does not produce all zero bits for integer 0 -> pointer (or vica versa) would have problems with this. That's why offsetof was created in ANSI. -- Michael Meissner, Data General Uucp: ...mcnc!rti-sel!dg_rtp!meissner It is 11pm, do you know what your sendmail and uucico are doing?