diff --git a/subject/main.c b/subject/main.c index d7e4a62..c3bdc3f 100644 --- a/subject/main.c +++ b/subject/main.c @@ -1,5 +1,6 @@ #include #include +#include #define container_of(ptr, type, member) ({ \ const typeof(((type*)0)->member)* __mptr = (ptr); \ @@ -29,5 +30,10 @@ int main(int argc, char** argv) { struct B b = { 1, 2, 3, NULL, 4.f, a, NULL }; b.m2 = 42; + + struct B* someB = (struct B*)malloc(sizeof(struct B)); + float* someB_m4 = &someB->m4; // This is not recognized yet, simply ends up as "add 0x10" + container_of(someB_m4, struct B, m4)->m1 = 'x'; + return 0; }