0-1-8. Exception: empty interface function. - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19) +---- Forum: 6.0 Language independent issues (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=129) +---- Thread: 0-1-8. Exception: empty interface function. (/showthread.php?tid=998) |
0-1-8. Exception: empty interface function. - Alex-R - 18-11-2013 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 } Re: 0-1-8. Exception: empty interface function. - banhamd - 10-12-2013 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. Re: 0-1-8. Exception: empty interface function. - misra cpp - 05-10-2015 This will require a deviation. This use-case will be reviewed in the next version of MISRA C++ RE: 0-1-8. Exception: empty interface function. - vmuthusu - 18-03-2024 (05-10-2015, 01:32 PM)misra cpp Wrote: This will require a deviation. Hi Has this been given deviation in the new version of MISRA C++. Can I have the details of it. Thanks V.Muthusubramanian RE: 0-1-8. Exception: empty interface function. - misra cpp - 07-06-2024 Rule 0-1-8 was reconsidered before publishing MISRA C++::2023, and has been removed. There were too many reasonable use cases where it was acceptable for a void function to not have side effects |