Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys/kern
On Tue, Jan 31, 2012 at 09:51:17PM +0000, Alexander Nasonov wrote:
> Joerg Sonnenberger wrote:
> > That's still not necessarily optimal, depending on the padding rules of
> > the platform. You want to do offsetof(s, m[0]) + n * sizeof((s*)NULL->m[0]).
>
> Using m[0] inside offsetof is non-standard but I think this will work:
>
> offsetof(s, m) + n * sizeof((s*)NULL->m[0]).
I don't believe there is a problem using m[0], just m[non-constant-expr].
OTOH 'sizeof (s *)0->m[0]' might be deemed invalid (because it has
an inferred dereference of NULL.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index