Object-oriented design patterns in the kernel, part 1
Posted Jun 3, 2011 13:51 UTC (Fri) by sethml (subscriber, #8471)
[Link]
Presumably because *this means something special in C++, and is not a common thing to write in C.
I've written this bug in C++ (memset(this, 0, sizeof(*this))) - clobbering your vtable pointer is pretty annoying to debug. My horrible hacky fix was just to zero the data portion of the class: memset(&firstMember, 0, (char *)(&lastMember + 1) - (char *)&firstMember)
Object-oriented design patterns in the kernel, part 1
Posted Jun 4, 2011 10:11 UTC (Sat) by liljencrantz (subscriber, #28458)
[Link]
I always use the name «this» for the object pointer when doing OOP in C. From what I've seen, this is a common convention.