Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
0-1-8. Exception: empty interface function.
The following are examples of external side effects:
• Reading or writing to a ile, stream, etc.;
• Changing the value of a non local variable;
• Changing the value of an argument having reference type;
• Using a volatile object;
• Raising an exception.

There is some mouse interface: OnMouseUp, OnMouseDone, OnMouseMove... or some other manipulator interface... does not matter...
There are some objects that use this interface but not all objects need all functions, so it is possible:
void SomeObject::OnMouseMove ( uint32 x, uint32 y)
//do nothing
Since you have to provide an implementation for an interface, even when it has null operations, you have no choice. Whether this rule should just apply to plain functions and not to class method functions is not clear, but an obvious solution. The introduction to the set of rules that this one belongs to, in section 6.0.1, sets out a clear intent that in the case of interfaces should be directed at the interface design and not specifically at uses of it resulting in null operations.
This will require a deviation.

This use-case will be reviewed in the next version of MISRA C++
Posted by and on behalf of
the MISRA C++ Working Group

Forum Jump:

Users browsing this thread: 1 Guest(s)