Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!paperboy!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: finding offset of a member in C structures Message-ID: <16236@smoke.brl.mil> Date: 22 May 91 20:56:17 GMT References: <22051@paperboy.OSF.ORG> <16220@smoke.brl.mil> <22103@paperboy.OSF.ORG> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 11 In article <22103@paperboy.OSF.ORG> dbrooks@osf.org (David Brooks) writes: >In article <16220@smoke.brl.mil>, gwyn@smoke.brl.mil (Doug Gwyn) writes: >|> ... If you understood my example, you should be able to apply >|> the technique whenever you can latch onto, for example, a pointer to a >|> struct of the appropriate type. >As I said, the ubiquitous uses in X don't have that luxury. But that's merely a design botch, because in order to ask for the offset of a structure member one HAS to have a particular structure type in mind; to make any use of the information one has to have a suitable pointer at hand. (The design botch is analogous to Berkeley's CTRL(x) macro.)