Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constexpr all the things, and noexcept #385

Closed
lgritz opened this issue Jun 7, 2019 · 4 comments
Closed

constexpr all the things, and noexcept #385

lgritz opened this issue Jun 7, 2019 · 4 comments
Labels
Enhancement A request for a change or enhancement. GSoC Good prolem for GSoC summer project

Comments

@lgritz
Copy link
Contributor

lgritz commented Jun 7, 2019

We're in a C++11 world (and indeed C++14 if you take VFX Platform literally). A huge amount of Imath should be marked constexpr, and for that matter there should be noexcept littered all over the place.

What I did in OIIO is directly 'constexpr' the things that could be so in C++11, and define a macro (we could call it ILMBASE_CONSTEXPR14, say) that would #define to constexpr if it detects C++ >= 14 but define to nothing for C++11. Maybe similar for 17 and 20. Then in the future as we raise the C++ floor, we can eventually make them unconditional constexpr.

It would also be helpful to noexcept all the things that aren't designed to throw exceptions.

Both of these are utterly trivial to do for any individual function, the pain is merely that there are dozens of headers to overhaul.

It shouldn't affect "source compatibility" -- in the sense that adorning Imath with constexpr and noexcept will not cause anybody to need to edit client software that uses libIlmbase, only to recompile to get the goodness.

@cary-ilm cary-ilm added the C++ label Jun 13, 2019
@lgritz lgritz added the GSoC Good prolem for GSoC summer project label Feb 2, 2020
@cary-ilm cary-ilm added Enhancement A request for a change or enhancement. and removed C++ labels Feb 6, 2020
@cary-ilm cary-ilm added this to the Next Major Release milestone Feb 7, 2020
@RajatYolo
Copy link

Hi,
I would like to work on this, can you share the mailing list so that I can updates time to time.
Thanks.

@patlefort
Copy link
Contributor

While we're at it, [[nodiscard]] (c++17 attribute) all the things too, the vast majority of functions with return values shouldn't be discarded.

@meshula
Copy link
Contributor

meshula commented Feb 12, 2021

see also AcademySoftwareFoundation/Imath#95

@lgritz
Copy link
Contributor Author

lgritz commented Apr 24, 2021

I believe that Imath 3.0 has done as much noexcept and constexpr as possible. Closing.

@lgritz lgritz closed this as completed Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A request for a change or enhancement. GSoC Good prolem for GSoC summer project
Projects
None yet
Development

No branches or pull requests

5 participants