Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Two standards problems Message-ID: <10412@smoke.BRL.MIL> Date: 16 Jun 89 22:06:09 GMT References: <178@ixi.UUCP <183@ixi.UUCP> <800@cbnewsl.ATT.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article <800@cbnewsl.ATT.COM> dfp@cbnewsl.ATT.COM (david.f.prosser) writes: > #define XtOffset(p, m) offsetof(*(p), m) In preparing my previous response to the question, I considered something similar, but it wasn't clear to me from the draft Standard exactly what was acceptable for the "type" argument to offsetof(). In particular the use of static type t; in the Standard bothered me; if one substitutes literally for "type" in that template, will constructs such as "*(p)" where "p" is a type name work? Some types need the identifier "t" buried inside them. Anyway, the proper declaration in this case would seem to be static p *t; so shouldn't the "type" argument to offsetof() be "p*"? I don't think this was specified clearly enough in the draft (although I would be happy to be proved wrong on this point).