struct wl_list from wayland project also works similarly. It really blew me away when I figured out how the macro uses pointer arithmetic to get the address of container.
Here's an article I wrote about the wl_list implementation:
<a href="http://www.sagartewari01.com/c-macro-magic/" rel="nofollow">http://www.sagartewari01.com/c-macro-magic/</a>