I see no reason for such a thing, g ++ and gcc are just different interfaces for the same compiler. Thus, for everyone regarding performance, byte compatibility, etc., there should be no problem mixing the .o files that are created by both.
C and C ++ have a lot of subtle differences that can cause you problems, starting with things like sizeof 'a' beeing different, but sizeof c is the same (if c is char ) so that bool is a type in one and the macro in another, true is of type bool in C ++ and int in C, C, not allowing static declarations in for ...
And even if it is that C and C ++ have a big intersection, if you limit yourself to what is considered good coding practice in both communities, you quickly find that the intersection is almost empty. This applies to casting pointers, highlighting with malloc or new , compound initializers and constructors, variable-length arrays and vector classes ...
Just don't do it. All you need to do is create a nice interface suitable for both.
source share