Closed levitte closed 1 month ago
There's oh so much more to do regarding constification, but a lot of it breaks against tomsfastmath, so that will need to change first.
Thanks for the PR! I also believe we should constify the API where possible.
This PR is slightly related to #174 #175 and #176
Regarding breaking tfm ... we could also constify the ltc API now and cast the const for tfm away. I checked tfm and it uses the arguments as if they were const anyway.
Maybe we should then introduce a macro instead of adding the cast explicitely? So we don't have to manually fix it again once tfm has been adapted resp. we can keep it as is, if someone has to build against an old tfm.
#if TFM_VERSION_something_something
/* oh yeah LTC_TFM_UNCOST is such a bad name */
#define LTC_TFM_UNCOST(type) (type)
#else
#define LTC_TFM_UNCOST(type)
#endif
We'd then also need to introduce TFM_VERSION_something_something
in tfm, so we know what to compare against ;) I've opened https://github.com/libtom/tomsfastmath/pull/36 to tackle that.
For now we could just add the "old path" in ltc and add the version compatibility once it's done in tfm.
I checked tfm and it uses the arguments as if they were const anyway.
haha, naive me :D looking at something and then doing it is sometimes very different ...
I hate having to cast.... but your idea is sane, and I do like the TFM_VERSION_3()
thing you added over in tomfastmath. So, I'm game, and will have at least a draft PR submitted fairly soon, based on TFM_VERSION_3()
.
Have a look at #667, which is the full constification of the math stuff, which also subsumes this PR.
Closing this in favor of #667
Drop the corresponding deconstying casts in code.
Fixes #581