MISRA Discussion Forums
Mixed C/C++ build environment - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: C++ General (https://forum.misra.org.uk/forumdisplay.php?fid=128)
+--- Thread: Mixed C/C++ build environment (/showthread.php?tid=1284)



Mixed C/C++ build environment - dg1980 - 11-10-2016

Could you write an explicit chapter on how to deal with this situation in the next version of the standard?
For example, i don't think this is what MISRA intended: http://support.gimpel.com/forums/225702-general/suggestions/11429436-improved-misra-checking-for-projects-with-mixed-c
Also, consider adding exceptions to some rules in the context of headers being included in both C and C++ modules:

Code:
#ifndef FOO_H
#define FOO_H

#define MAGIC_CONSTANT 123456/*Violates MISRA C++ Rule 16-2-2, but is fine in C and changing would require storage in C (effiency)*/
typedef int int32_t;

#ifdef __cplusplus
extern "C"
{
#endif

int32_t foo_api(void);

#ifdef __cplusplus
}
#endif

#endif

Thank you very much.