Mixed C/C++ build environment

Questions and discussions about MISRA C++ not fitting under rules forums

Moderators: david ward, misra cpp

Post Reply
dg1980
Posts: 117
Joined: Wed Apr 27, 2016 2:33 pm
Company: Elektrobit Automotive GmbH

Mixed C/C++ build environment

Post by dg1980 » Tue Oct 11, 2016 12:40 pm

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 ... th-mixed-c
Also, consider adding exceptions to some rules in the context of headers being included in both C and C++ modules:

Code: Select all

#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.

Post Reply

Return to “C++ General”