Hi, On Tuesday 2010-06-01 08:49, Ian Lance Taylor wrote: >[...] > >This is going to expand into > > for ((pos) = list_entry((&clh)->next, typeof(*(pos)), member); >==> > for ((pos) = containerof(((&clh)->next), typeof(*(pos)), member) >==> > for ((pos) = (typeof(*(pos)) *)((char *)((&clh)->next) - offsetof(...) > >At this point you are starting with the field clh.next, which has type >"struct list_head", you are casting to to "char *", and you are >accessing it as type "struct item *". That is an aliasing violation. Since in this particular case, member is the first field, one could also write for (pos = (struct item *)clh.next; ...) I hear that "C specifies that a struct * can be converted to and from a pointer to its first element." Does that change anything? thanks, Jan