flintlib / arb

Arb has been merged into FLINT -- use https://github.com/flintlib/flint/ instead
http://arblib.org/
GNU Lesser General Public License v2.1
455 stars 137 forks source link

Determining Arb version at compilation time #311

Closed bluescarni closed 4 years ago

bluescarni commented 4 years ago

Is it possible to determine the Arb version in use at compile time? E.g., as a preprocessor definition?

This would be useful to selectively enable/disable code in a library which depends on Arb. For instance, I noticed that the acb_agm() function was added in 2.18 (if I am not mistaken), but at the moment I don't see any way of knowing if I can refer to/invoke this function purely from within the source code of a library which depends on Arb.

(Such a check can be done at the level of the build system, but it would be useful to have the version information also as preprocessor definitions in the headers)

fredrik-johansson commented 4 years ago

I added such version numbers in c72a7ec1e190c9721162e3419bf029625df42167 (copying the format from flint), though they erroneously give the number as 2.18.0 right now. I will try to remember to set them to the right values for the 2.18.1 patch release :-)

bluescarni commented 4 years ago

Cheers! Any chance that identifiers starting with double underscore __ could be avoided? Names with leading double underscores are supposed to be reserved for the C/C++ library implementation:

https://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier

fredrik-johansson commented 4 years ago

I used the same naming convention as Flint (as well as GMP) to keep surprises to a minimum. It's unlikely that it's going to clash with anything else.

bluescarni commented 4 years ago

Ok sounds good. Thanks, closing.