3 ms·
Forgive me if I don't know what I'm talking about here, but could volatile be used here to force the compiler to perform the memset?
by saagarjha 10y ago
Forgive me if I don't know what I'm talking about here, but could volatile be used here to force the compiler to perform the memset?
- HorizonXP 10y agoYou're correct. (https://barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword https://barrgroup.com/Embedded-Systems/How-To/C-Volatile-Key...) But again, you're telling the compiler that you know what you're doing, and to not perform its normal optimization. I'm not well-versed in compiler design, but I think that's the tradeoff you have to make between trusting the user's design choices, or not.