Two standards problems
Doug Gwyn
gwyn at smoke.BRL.MIL
Sat Jun 17 08:06:09 AEST 1989
In article <800 at cbnewsl.ATT.COM> dfp at 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).
More information about the Comp.std.c
mailing list