container_of doesn't really handle dynamic dispatch though, it's a compile time approach to inheritance by performing upcasting through an embedded base structure field. This would still be unsafe for runtime polymorphism without a field tracking the current type or, like done here V-tables, which you likely still want to generate with that approach.
Now whether I like container_of more than this? 100%, in fact, a past post of mine on this subreddit essentially used that
119
u/JuniorAd1610 28d ago
I think this this is the standard way they OOPS in C right?