-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Use templates for common geometric constants #7558
base: master
Are you sure you want to change the base?
Conversation
You should use |
Updated to account for `<numbers>` and C++20: - Marked all `lmms_constants.h` constants with an exact equivalent in `<numbers>` as deprecated - Removed all `lmms_constants.h` constants where no variant is currently in use - Using `inline constexpr` - Using `std::floating_point` concept instead of `typename`
Updated to account for
|
This won't work. I suggested waiting for C++20 and the compiler upgrade since we are in the process of doing that now. Currently we are using C++17 and GCC 9.3 for Linux and MinGW builds, so we can't use the If you wanted, maybe you could convert our mathematical constants to use the same names as those in EDIT: The constants should probably be in a new |
I'm aware that we don't have C++20 ready yet. I made the suggested changes (and more) in advance under the assumption that this PR was now dependent on #7554, based off of your suggestion. If this is not the case I can change it back, I'm good with whatever. My original intention with this PR was small in scope; I just wanted to clean up |
Ah gotcha. Sorry for the miscommunication. The C++20 support could happen tomorrow if people could review the PR, but upgrading our MinGW compiler and dependencies will be tricky and take some time. I think the |
If I understand @messmerd correctly, I agree with him. We should wait for C++20, remove |
Just to clarify, there are several useful constants in On that note, I noticed The current plan is to wait for #7554 before I make further changes. Input is welcome in the meantime! |
lmms_constants.h
has several common constants such asPI
andE
, with variants of each forfloat
,double
, andlong double
. Many of these are currently unused in the repo but are of potential use. This change replacesLD_PI
,D_PI
, andF_PI
withPi<T>
, and so on.Between a lot of plugins having their own
#define PI 3.14...
and the coding conventions stating "Global scope constants SHALL use UpperCamelCase", these new template constants use upper camel case instead of upper snake case.Constants that are currently in use have not been removed for now, so this PR only touches
lmms_constants.h
. There are a few options:[[deprecated]]
to discourage new use