volatile this en c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

volatile this en c++

Volatile this no entiendo como se puede usar, ni para que sirve, me gustaría que pudieran darme un ejemplo de su uso.

25th Feb 2019, 2:10 PM
Anderson Mauricio Moncada
Anderson Mauricio Moncada - avatar
1 Answer
0
I hope it is ok to anwer in English. Volatile means: every time when the value is used in the code it is re-read from the memory, also it might already be in a register. Where does this help - in multi-threaded environments - you make sure that the latest value in the variable is read, that might have been changed since last access by another thread. If you don't do mutli-threaded programming ignore volatile.
25th Feb 2019, 5:45 PM
nobody