Hacker News new | ask | show | jobs
by flohofwoe 1162 days ago
The difference is that a CPU does way less magic under the hood than an optimizing compiler for a high level language, and there's no such thing as UB in assembly (outside some exotic cases like 'illegal' instructions on the 6502 which behave unpredictably)
1 comments

Meltdown/Spectre pulled back the curtain and revealed just how much magic is going on with modern CPUs.
But it only really manifests as timing.
This.

The cpu magic doesn't do things you didn't ask for, or can't figure out how to ask for through a bunch of indirection.

All the cpu magic means is that you don't know how it did exactly what you expected. It still produced exactly and only the expected output from the given input.

High level language magic means it does things you didn't expect, and that you can have a hard time figuring out how to get it to do something you want if that doesn't happen to be one of the things the language designers predicted and decided for you that you should ever need to do.