Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site pyuxt.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!pyuxww!pyuxt!marcus From: marcus@pyuxt.UUCP (M. G. Hand) Newsgroups: net.lang.c Subject: Re: proposed new construct, offsetof() Message-ID: <202@pyuxt.UUCP> Date: Fri, 26-Oct-84 15:11:25 EDT Article-I.D.: pyuxt.202 Posted: Fri Oct 26 15:11:25 1984 Date-Received: Sat, 27-Oct-84 04:09:18 EDT References: <1583@wateng.UUCP> Organization: Bell Communications Research, Piscataway N.J. Lines: 15 Well, if you really want to know what the actual offset into your data structure is (as opposed to some logical naming method like struct.mem) you should try using BCPL instead of C. Try this: LAST.LIST!NEXT := NEWVEC(SIZE.OF.LIST) LIST.MEM := LAST.LIST!NEXT PACKSTRING(LIST.MEM!NAME, "a string") where NEXT and NAME are simple integers giving offsets into the vector returned by NEWVEC. Ie you get a simple contiguous block of BCPL words and its is up to you how you partition it. To get machine portability you are guaranteed the manifets constants BCPLBYTESPERWORD and BITSPERBYTE which can be used as scaling factors. Fun, eh? marcus