On Fri, Mar 22, 2013 at 01:36:01PM +0000, Taylor R Campbell wrote: > We could do the arithmetic without a macro, but it's more complicated > to get that correct. Compare > > struct foo *f = alloc(offsetin(*f, f_data[n])); > > with > > struct foo *f = alloc(sizeof(*f) + sizeof(typeof(f->f_data[0])[n]));
if you fix this to read
struct foo *f = alloc(sizeof(*f) + n * sizeof(f->f_data[0]));
it ceases to be a problem, IMO.
--
David A. Holland
[email protected]
