realloc
realloc
Posted Jul 12, 2021 19:22 UTC (Mon) by khim (subscriber, #9252)In reply to: realloc by excors
Parent article: Rust for Linux redux
> Compiler developers' mental models were a lot more complex, but also a lot closer to being logically consistent and complete, because they had already thought about most of those edge cases and invented new concepts and terminology so they could implement it in a way that balanced users' expectations of correctness and performance.
No. It was neither consistent nor complete. That's why they weren't able to add pointer provenance neither to C11 nor to C18. The latest attempt is here. Please note the dates.
> Maybe it wasn't the best balance, but at least it was based on a coherent set of rules that could be reasoned about.Nope. Not even close. Kinda-sorta coherent models were developed (here is one attempt) — but they don't match what the compilers are actually doing (the new model requires a handful of problematic IR-level optimizations to be removed, but it also supports the addition of new optimizations that were not previously legal is pretty telling, isn't it?) and, more importantly, it's not clear why they are supposed to be applicable to C89 or even C99 programs.
> So it's inevitable that the specification grew into being a compiler developer's interpretation of the languageIt haven't done that yet. Pointer provenance is not a thing — even in C18 version of C standard.
> It's not good, but it's better than leaving it ambiguous.Good for whom? Compiler writers? Maybe. It's bad for C users, definitely, but since they couldn't present anything better they had only one option: accept the standard or live without a compiler.
But now it looks as if accepting standard is not enough. That is the problem.
When the story was presented as “Semi-portable C” vs “Standard C” this sounded like a sensible compromise: sure standard maybe harsh is some places, but hey, it's a standard!
Now, then we know that compiler developers don't feel themselves restricted by requirements of the standard the question arises: why then C users demands to change the standard are ignored? Hmm?