Given the following class:

class MyClass {
  public:
    int value() const {
      return value_;
    }

  private:
    volatile int value_;
};

Does the value() member function also have to be marked as volatile to avoid getting optimized away or is it okay as written? Thanks.

Edit
Report