logoalt Hacker News

runekstoday at 9:51 AM3 repliesview on HN

Wouldn't the compiler take care of producing the correct machine code?


Replies

octachrontoday at 10:32 AM

The issue is that the C memory model allows more behaviours than the memory model of x86-64 processors. You can thus write code which is incorrect according to the C language specification but will happen to work on x86-64 processors. Moving to arm64 (with its weaker memory model than x86-64) will then reveal the latent bug in your program.

show 1 reply
mrweaseltoday at 11:21 AM

OpenBSD famously keeps a lot of esoteric platforms around, because running the same code on multiple architectures reveal a lot of bugs. At least that was one of the arguments previously.

mhh__today at 9:53 AM

The compiler relies on the language and programmer to enforce and follow a memory consistency model