Re:John Carmack on Mutable Variables
by tialaramex on Friday October 31, 2025 @06:52PM
(#45777589)
That's not a constant, that's an immutable variable which is why your diagnostic said it was read-only.
And since I paid for the place where I'm writing this with cash earned writing C a decade or so ago, I think we can rule out "unfamiliar with C" as a symptom.
[ Parent
| on HN ]
Now x is 3 but you also get a compiler warning telling you not to do that.
In my opinion it's a bit disingenuous to argue that it isn't a const just because you can ignore the compiler and shoot yourself in the foot. If you listen to the compiler, it is reflected in the assembly that it is a constant value the same as #define x 2.
Is Rust better at enforcing guarantees? Of course. Is `const` in C `const` if you don't ignore compiler warnings and errors? Also of course.
> And since I paid for the place where I'm writing this with cash earned writing C a decade or so ago
Ditto!