Proverbially Playing the `Devil's Advocate' for Rule 15-1-2 - 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.15 Exception handling (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=143) +---- Thread: Proverbially Playing the `Devil's Advocate' for Rule 15-1-2 (/showthread.php?tid=581) |
Proverbially Playing the `Devil's Advocate' for Rule 15-1-2 - gs - 11-09-2008 The text and rationale of rule 15-1-2 make no mention of the word `macro'. Let us suppose an application made no reference to the Standard Library within it's source code. Consequently, the `NULL' macro has not been defined. Would the following code violate rule 15-1-2? Code: class A {}; Furthermore, the wording of the rationale is slightly incorrect: Quote:throw(NULL) (equivalent to throw(0)) is never a throw of the null-pointer-constant ...To quote ISO C++, 18.1, para. 4, (lib.support.types): Quote:The macro NULL is an implementation-defined C++ null pointer constant in this International StandardGranted, the referenced `4.10' states a null pointer constant has integer (not pointer) type. However, the macro is a null pointer constant. Re: Proverbially Playing the `Devil's Advocate' for Rule 15-1-2 - misra cpp - 07-10-2015 Rule 17-0-2 disallows the reuse of names of standard library MACROs. Reusing NULL is therefore a violation of this rule. |