top | item 3604474

(no title)

cron | 14 years ago

The Linux kernel `container_of` and `offset_of` macros can be pretty handy when writing generic containers.

discuss

order

Arelius|14 years ago

While those are both implemented as macros, I'd hardly call them "macro magic" at least not in the manner used by OP, or what I was talking about.

Both of those are actually rather simple macros doing what seems like a mess with pointers. The difference is subtle, but most strongly expressed in that the complexity is innate to the problem, and does not require mucking much with what is entirely weird macro behavior.