Why isn't this released as a library (as opposed to a program)?
203: Ideas the future (may or may not happen):
204:
205: * Bundle up the units conversion stuff into a library.
At the end of units.c, too: 6280: /* NOTES:
6281:
6282: mymalloc, growbuffer and tryallunits are the only places with print
6283: statements that should (?) be removed to make a library. How can
6284: error reporting in these functions (memory allocation errors) be
6285: handled cleanly for a library implementation?
6286:
6287: Way to report the reduced form of the two operands of a sum when
6288: they are not conformable.
6289:
6290: Way to report the required domain when getting an domain error.
6291:
6292: */
My prowling of the source code is probably uninformed because I'm not a C expert by any means but it seems like you could include units.h and use many of the useful functions in another program.It implements units using a ton of templates and "compile-time metaprogramming". [0]
The nice thing is that it has no runtime overhead as all templates are "compiled away". The disadvantage is that when you make a mistake against units, it results in a "template compiler error explosion".
[0]https://www.boost.org/doc/libs/1_65_0/doc/html/boost_units.h...