Rule 16-0-1 and extern "C" - 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.16 Preprocessing directives (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=144) +---- Thread: Rule 16-0-1 and extern "C" (/showthread.php?tid=1222) |
Rule 16-0-1 and extern "C" - detra - 14-01-2016 Hello, if we want to use the same Header files for "C" and "C++" we must use the "extern C" constuct. But the "extern C" construct must be placed before the include of the Header and so our tool reports a MISRA 16-0-1 violation. Is this violation valid? And if so, is there an other solution? Code: #ifndef _MYHEADER_ Thank you for help, Stefan Re: Rule 16-0-1 and extern "C" - dg1980 - 28-04-2016 Probably a bit late (i just registered), but the best way to do this is: https://isocpp.org/wiki/faq/mixing-c-and-cpp#include-c-hdrs-personal Re: Rule 16-0-1 and extern "C" - misra cpp - 11-10-2016 This is non-compliant and requires a deviation |