F2I-Consulting / fesapi

DevKit for ENERGISTICS™ data standards (mainly RESQML™), multi-languages (C++, Java, C#, Python)
Apache License 2.0
32 stars 24 forks source link

Provide broken-down FESAPI version as numbers #304

Closed cgodkin closed 1 year ago

cgodkin commented 1 year ago

Is your feature request related to a problem? Please describe. When upgrading from FESAPI 2.2 to FESAPI 2.3, I had to make some code changes. It would have been useful to be able to have my code conditionally build for either version. However, as far as I can see, the only FESAPI version is a string.

Describe the solution you'd like I would suggest that the FESAPI version string be built up from numbers so the C preprocessor could do comparisons. Something like

#define FESAPI_MAJOR_VERSION 2
#define FESAPI_MINOR_VERSION 3
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#define FESAPI_VERSION STR(FESAPI_MAJOR_VER) STR(FESAPI_MINOR_VER) 

Describe alternatives you've considered I don't think there's a way to do comparisons with strings in the C preprprocessor.

Additional context I am not too clever about using the C preprocessor so I got the syntax above from here.

philippeVerney commented 1 year ago

It makes perfect sens. I'll look at that soon.

Thank you!

philippeVerney commented 1 year ago

For extra information: