On Sat, Mar 10, 2012 at 19:07, Stephen LARROQUE <lrq3...@gmail.com> wrote: > Hello Ben, > > Thank you very much for your code, I wish I could write so much complicated > defines by myself ;) > > Unfortunately your code does not work right away, first becauseĀ as_gent > takes entityShared_t as argument instead of sharedEntity_t, and secondly > your function only returns the r member, which is in fact an entityShared_t, > but this is not what I'm looking for.
Yes, sorry. There's a typo in the example, it should have read: return container_of(shared_ent, gentity_t, r); IOW, take the field offset of `r` and subtract it from the `shared_ent` pointer to get the address of the enclosing `gentity_t` struct. _______________________________________________ ioquake3 mailing list ioquake3@lists.ioquake.org http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org By sending this message I agree to love ioquake3 and libsdl.