I was looking at the container_of macro, and this piece of code confuses me a bit:
Why is it legal to cast 0 (null pointer?) into some (type *) and then deference it to get the structure's member field? Shouldn't it cause some kind of segmentation violation?Code:const typeof( ((type *)0)->member ) *__mptr = (ptr);