Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!rex!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: OFFSET -macro (also offsetof in ANSI-C) Message-ID: <14590@smoke.brl.mil> Date: 27 Nov 90 18:29:10 GMT References: <898@ehviea.ine.philips.nl> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 8 In article <898@ehviea.ine.philips.nl> ncpg@ehviea.ine.philips.nl (ncpg) writes: >#define OFFSET(structPtr, field) ((unsigned short) \ > (&((char *)(structPtr->field))) - \ > &((char *)(structPtr))) This wouldn't be right anyway. It's &structPtr->field that you want to use; you cannot apply & to the result of an object cast because it's not an lvalue.