logoalt Hacker News

saagarjhatoday at 11:52 AM1 replyview on HN

No this is irrelevant for making this decision


Replies

shaknatoday at 12:01 PM

I've mentioned elsewhere the standards, and compilers as well, disagreeing with you here.

But feel free to run against the various compilers through godbolt. [0] They won't optimise the branch away. Access to a volatile, must be preserved, in the order that they exist. No optimisation, UB or otherwise, is allowed to impede that. Because an access is a side-effect.

[0] https://godbolt.org/z/85cGhq3Ta

show 2 replies