On 08/28/12, <b class="name">Peter Hutterer </b> <peter.hutterer@who-t.net> wrote:<br /><blockquote cite="mid:20120829063550.GA11153@yabbi.redhat.com" class="iwcQuote" style="border-left: 1px solid #00F; padding-left: 13px; margin-left: 0;" type="cite"><div class="mimepart text plain">> -#define __container_of(ptr, sample, member)                         \<br />> -    (void *)((char *)(ptr)                                           \<br />> -             - ((char *)&(sample)->member - (char *)(sample)))<br />> +#define __container_of(ptr, sample, member)                   \<br />> +    container_of(ptr, typeof(*sample), member)<br /><br />typeof is a gcc extension/c99 and I don't think we support that yet, do we?</div></blockquote><div>I thought we were expecting C99 nowadays.  CCing Alan since I think he knows the answer to that and can chime in re: SunCC.</div><div><br /></div><div>In any event, typeof is in *a* standard whereas the previous implementation is undefined (and can lead to crashes on startup).  I'd vote for doing something that is in a 13 year old standard over something that has undefined behavior.</div><div><br /></div><div>If there is concern over this breaking gcc-3.2 or some ancient compiler, I'm happy to update it to use $ifdef guarding.  At minimum, I'd like to get this changed for __clang__ before 1.13 ships.</div><div><br /></div><div>--Jeremy</div><div><br /></div>