0-1-8. Exception: empty interface function.

Moderators: david ward, misra cpp

Post Reply
Posts: 2
Joined: Tue Oct 29, 2013 3:00 pm
Company: Luxoft

0-1-8. Exception: empty interface function.

Post by Alex-R » Mon Nov 18, 2013 1:55 pm

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

Posts: 9
Joined: Tue Feb 05, 2008 3:48 pm
Company: Rolls-Royce PLC
Location: Stafford

Re: 0-1-8. Exception: empty interface function.

Post by banhamd » Tue Dec 10, 2013 3:58 pm

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.

misra cpp
Posts: 157
Joined: Mon Jun 02, 2008 1:55 pm
Company: MISRA

Re: 0-1-8. Exception: empty interface function.

Post by misra cpp » Mon Oct 05, 2015 2:32 pm

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

Post Reply

Return to “6.0 Language independent issues (C++)”