...which is a lot like disabling safety mechanisms on tools for the sake of being "macho"/saving time/whatever.
Talking about C not C++ here, and specifically aliasing UB. It's one of the easier types of UB to fully preclude.
-
-
I was talking about C as well, I meant inheritance like in the kernel. struct A { struct Parent p; }, ditto vf struct f_ops { fun_ptr p; }.
-
Yeah, I consider it an argument for not doing that. Linux kernel is basically a tutorial on how not to write C. :-)
-
How else would you implement inheritance?
-
Indeed, there's essentially no way without either round trip (unchanged type tho) through void* or container_of type tricks.
-
Structure to how you do it can limit risk of mistakes, but avoiding gratuitous OOP-like design in favor of more static code is better IMO.
-
Can any large project avoid any OOP altogether? I'm not sure. And in practice most don't. Point is modern language enables that safely.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.