3 ms·
Low level code can and should use assembly to get the precise effect they desire in these cases.
by account42 2mo ago
Low level code can and should use assembly to get the precise effect they desire in these cases.
- mdspan 2mo agoThat would be pretty cumbersome though. If you're targeting N different architectures, you would have to write N different assembly blocks.
- rcxdude 2mo agoI shouldn't need to drop to assembly to get an infinite loop that works!
- echoangle 2mo agoWhy not just allow infinite loops instead of having me write assembly for it though?
- account42 2mo agoBecause a compiler being allowed to assume that a loop always terminates gives it more room to optimize the 99% of loops that aren't supposed to run until the heat death of the universe.
- echoangle 2mo agoOr you could just detect while loops with constant condition (like the C standard) and not touch any programs that don't exhibit UB while allowing infinite loops for other use cases at zero runtime cost and negligible compile cost.