← Back to context

Comment by Joker_vD

1 year ago

Pointers to unallocated memory are not allowed to be read from, in any form. You have to manage memory with uintptr_t arithmetic which arguably makes pointer arithmetic in C almost completely useless for writing malloc().

That's not a consequence of effective type (i.e., strict aliasing) rules, that's a consequence of pointer provenance rules. And a little more generally, it's a consequence of malloc having special object system behavior that there's no way to express in pure C code.