Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 16-0-1 and extern "C"
#1
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_
#define _MYHEADER_

extern "C"
{
    #include "firstheader.h"                // MISRA 16-0-1 violation
}

Thank you for help,
Stefan
<t></t>
Reply
#2
Probably a bit late (i just registered), but the best way to do this is: https://isocpp.org/wiki/faq/mixing-c-and...s-personal
<t></t>
Reply
#3
This is non-compliant and requires a deviation
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)