I have slight confusion. If i use volatile keyword to structure, is it sufficient if i apply to the structure? or i need to apply to individual members also. How does the compiler handle if we give additional volatile keywords than expected.
I have slight confusion. If i use volatile keyword to structure, is it sufficient if i apply to the structure? or i need to apply to individual members also. How does the compiler handle if we give additional volatile keywords than expected.
If you aren't using an embedded compiler, then volatile is only useful with a global sig_atomic_t, to be used in a signal handler. sig_atomic_t - cppreference.com
If this is for multiple thread access, then you are doing it wrong.
volatile specifier applies the same way const does. If a structure is const, then all it's members are as well. And if a member of that struct is already const, the compiler understands.
gg