This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM-Cortex M4 - Keil uvision5 - Is mixing C & C++ possible ?

I have a Keil uvision 5 and currently using for ARM-Cortex-M4 for compiling sources.

I am using C language files. Can I use C++ files or library in this environment and access the definitions.

Is mixing C and C++ possible?

Thanks,

Parents
  • It's possible to mix C and C++. But requires that you understand the differences between them and what is and what isn't compatible.

    A C++ function can always call a C function (as long as it knows the target is a C function).

    A C function can only call a C++ function that has been specified to use the C calling/naming convention.

    But there are other things too - like a C function can obvisouly never catch a C++ exception. And while C++ uses new/delete, C uses malloc()/free().

Reply
  • It's possible to mix C and C++. But requires that you understand the differences between them and what is and what isn't compatible.

    A C++ function can always call a C function (as long as it knows the target is a C function).

    A C function can only call a C++ function that has been specified to use the C calling/naming convention.

    But there are other things too - like a C function can obvisouly never catch a C++ exception. And while C++ uses new/delete, C uses malloc()/free().

Children
No data