volatile keyword is not everything to prevent compiler optimization

volatile keyword is not everything to prevent compiler optimization

2014/12/10 Programming 0

When you add the keyword “volatile” in front of variable declaration, it prevents compiler to optimize the line that are using that variable. But if the line is completely useless, compiler will still optimized it out, prevent to generate any byte code for it.

still-optimized-out-useless-line

read count : 262

Leave a Reply

Your email address will not be published. Required fields are marked *