1 year ago

#191168

test-img

fizzybones

Should I use volatile for ISRs in C++? (not C)

I commonly see that variables which are accessed by ISRs should be marked as volatile. I can understand this would be the case in pure C, where the compiler isn't aware of other threads. Is this still the case in C++, where the compiler understands that non-local variables can be accessed by other threads?

If volatile is needed, what makes the ISR different from just any other thread?

c++

c

volatile

isr

0 Answers

Your Answer

Accepted video resources