I have doubts about many things related with the different C specifications.
If I program a library in C99, can I use it from C89 code? (using only the functions with C89 compliant definitions).
example, this code would be usable in C89?
Header of a shared library:
#ifdef C99
void func (double complex a, double complex b); // C99 function
#endif
/* another C89 compliant function */
void func2 (double a, double b);
Thanks in advance :)
The C language does not say anything about binary compatibility of C89 and C99 code. That is entirely up to the compilers you use for the different parts of the executable.
If you can make the external headers of your library palatable for a C89 compiler, I don't see any obvious reason why it would not work, except for the usual issue of making sure that two compilers can generate compatible code.
Instead of #ifdef C99
, use #if __STDC_VERSION__ > 199900L
or similar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With