Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!gatech!mcnc!uvaarpa!haven!ncifcrf!lhc!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Taking address of array Message-ID: <15818@smoke.brl.mil> Date: 12 Apr 91 21:56:09 GMT References: <1991Apr9.172534.28982@tcom.stc.co.uk> <12010@dog.ee.lbl.gov> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 8 In article <12010@dog.ee.lbl.gov> torek@elf.ee.lbl.gov (Chris Torek) writes: > #define offsetof(s, e) ((int)((char *)&((s *)0)->e - (char *)0)) If you have access to some structure of the desired type, which should always be the case when using such a macro, you could add an argument to take the structure for the base address, rather than playing nonportable games with casts of "0". The STD_C equivalent could then just invoke offsetof() and ignore the extra structure argument.