-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Core: Add constexpr
constructors/operators to math structs
#98768
Core: Add constexpr
constructors/operators to math structs
#98768
Conversation
I'll do a test to see how it affects Web builds size. Could be interesting if it reduces size, less if it bloats the builds. |
From my test, it doesn't really seem to affect build size at all. So I'm all for the PR. |
I'm not sure about this. I think moving more towards Our best practices for contributors highlight that "the problem must come before the solution" and "the problem must exist in the first place" In other words, we shouldn't be anticipating problems and then trying to solve them. I think this PR is well-intentioned and is doing something that might be helpful, but I don't think it is solving any problem and is trying to get ahead of something that might be a problem in the future. Similarly with [[nodiscard]], by adding it indiscriminately, we are adding noise to the git repo, adding compile time to CI and local projects, and complicating the codebase for other contributors. But we aren't solving any problems. [[nodiscard]] is helpful in some cases (which is why we use it in some cases), but we should only be applying it when we need it. Its not something we should just add it everywhere just because. |
I can concede the
This might not be a direct response to a "problem" needing to be solved, but I wouldn't say that it's trying to be that either. This feels more in-line with codestyle/QOL PRs, where the benefits come from the repo itself having more functionality/readability. |
0b59e8c
to
a63ef23
Compare
While I agree with the premise, I think we should be cautious applying this principle relative to code style changes. Especially if code changes simplify the code. |
a63ef23
to
6f90309
Compare
6f90309
to
5b13725
Compare
5b13725
to
05802ef
Compare
05802ef
to
aec85e6
Compare
aec85e6
to
3730321
Compare
constexpr
operators to math structsconstexpr
constructors/operators to math structs
Now that #92059 is closed, this functionally supersedes that PR; renamed the title/commit message to include constructors as well |
7ed9246
to
c66ea9f
Compare
• Begin integrating `constexpr` on math tests; use `static_assert` where appropriate
c66ea9f
to
ea62170
Compare
constexpr
#91992constexpr
constructors to math structs #92059In the same vein as #92059, the goal with this PR is to exclusively change operators that could be converted to
constexpr
as-is; anything that would necessitate other functions/calls were simply left untouched. Similarly, the actual structure of the code itself was left untouched where possible, excluding only the cases where an operator could be migrated to the header. Beyond that, there were two other adjustments in this PR:Adding aNah[[nodiscard]]
annotation to operators returning primative typesconstexpr
& checks tostatic_assert
where possible