4 ms·
That's what the keyword volatile is for. If something is not marked volatile the compiler is allowed to change the order and collapse any memory accesses it dee
by morio 9y ago
That's what the keyword volatile is for. If something is not marked volatile the compiler is allowed to change the order and collapse any memory accesses it deems unnecessary.
- lomnakkus 9y agoIndeed, but I don't think that was the poster I was responding to was talking about? I mean, he/she was talking about bitfields and similar things and how writes to those could be coalesced? In genreal, they cannot. (I dunno, it seemed appropriate to mention the caveats.)
- carlmr 9y agoNot coalescing writes on non-volatile bitfields probably isn't guaranteed by the standard. If you depend on it I hope you have a test catching that.
- AstralStorm 9y agoWhy use bit fields at all instead of straightforward bit math then? They're not really convenient and have weird alignment rules already.