W8051 Non-volatile function 'function' called for volatile object (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

(Command-line option to suppress warning: -w-nvf)

In C++, a class member function was called for a volatile object of the class type, but the function was not declared with volatile following the function header. Only a volatile member function can be called for a volatile object.

For example, if you have

  class c
  {
  public:
    f() volatile;
    g();
  };
  volatile c vcvar;

it is legal to call vcvar.f(), but not to call vcvar.g().