Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
0-1-8. Exception: empty interface function.
#1
0-1-8:
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.


Situation:
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
}
<t></t>
Reply
#2
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.
<t></t>
Reply
#3
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
Reply
#4
(05-10-2015, 01:32 PM)misra cpp Wrote: This will require a deviation.

This use-case will be reviewed in the next version of MISRA C++

Hi
Has this been given deviation in the new version of MISRA C++.
Can I have the details of it.

Thanks
V.Muthusubramanian
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)