McCode icon indicating copy to clipboard operation
McCode copied to clipboard

C macro version awareness

Open g5t opened this issue 10 months ago • 0 comments

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

g5t avatar Apr 03 '24 12:04 g5t