Question d’entretien chez Arm

What does volatile mean?

Réponses aux questions d'entretien

Utilisateur anonyme

18 août 2020

Volatile tells the compiler to not optimize the variable. As mentioned by in the previous answer, the data is read from the register and not the cache. This is used when a variable's value might change unpredictably and out of the control of code.

1

Utilisateur anonyme

4 déc. 2016

Volatile means that it can be changed out of the program. For example, if you use a value of a HW register, you should make it volatile. If not, your program might read the value from cache while the HW changes the value.