Losing the magic
Losing the magic
Posted Dec 7, 2022 19:06 UTC (Wed) by khim (subscriber, #9252)In reply to: Losing the magic by farnz
Parent article: Losing the magic
> If there is no UB in my source code, then there is also no UB in the resulting binary, absent bugs/faults in the compiler, the OS or the hardware.
We don't disagree there, but that's not what O_PONIES lovers are ready to accept.
Yes. Because that's what O_PONIES lovers demand to handle! They, basically, say that it doesn't matter whether L have UB or not. It only matters whether M have UB. If M doesn't have “suitably similar” UB then program in L must be handled correctly even if it violates rules of language L.
Unfortunately on practice it works only in two cases:
- If L and M are extremely similar (like machine code and assembeler)
or - If translator from L to M is so primitive that you can, basically, predict how precisely each construct from L maps to M (old C compilers)
Ah, got it. Yeah, in that sense it's one-way street in the absence of bugs. Of course bugs may move things from M to L (see Meltdown and Spectre), but in the absence of bugs it's one way street, I agree.
> This is a lot of work, and involves getting a full understanding of why people want certain behaviours to be UB, rather than defined in a non-deterministic fashion.And it's also explicitly not what O_PONIES lovers want. They explicitly don't want all that hassle, they just want the ability to write code in L with UB and get a working program. That is really pure O_PONIES — exactly like in that story with Linux kernel.
List of UBs in C and C++ is still patently insane, but that's different issue. It would have been possible to tackle that issue if O_PONIES lovers actually wanted to alter the spec. That's not what they want. They want ponies.