McCode
McCode copied to clipboard
C macro version awareness
Version information in generated C code could be useful to component authors wishing to make use of bleeding-edge developments without breaking backwards compatibility for older McCode versions. One way to provide this would be through an integer-valued macro, e.g., __MCCODE_VERSION__
, created via something like
#define __MCCODE_VERSION__ 304038L
Then a component block that is C code can use, e.g.,
#if defined(__MCCODE_VERSION__) && __MCCODE_VERSION__ >= 304003L
// do something only possible thanks to a patch in 3.4.3
#else
// use a workaround or issue a warning/error
#endif