5 ms·
How would you implement objects and inheritance in C without function casts? CPython certainly uses these casts. dlysm() even relies on a (void *) cast that is
by gtaena 2y ago
How would you implement objects and inheritance in C without function casts? CPython certainly uses these casts.
dlysm() even relies on a (void *) cast that is not C standard compliant.
C is useless for certain applications with this "undefined behavior".
- pjmlp 2y agoThat is the thing, people keep treating it as a portable macro assembler, when it stopped being so decades ago, and those folks haven't yet got the memo.
- pistoleer 2y agoUse a generic function signature that takes in a `void*`. Inside the specialized function bodies, cast the void* to an `actual_type*`, then dereference.