Skip to content

Comment on UndefinedBehaviorSanitizer's Unexpected Behaviorparent

Comments

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".

That 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.

Use a generic function signature that takes in a `void*`. Inside the specialized function bodies, cast the void* to an `actual_type*`, then dereference.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.