-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
fix: remove redundancy with constexpr variables #1149
Conversation
constexpr variables are evaluated at compile time and replace each of their invokation with it's value before compilation to ASM both inline and const as keywords are redundant/do not do anything to constexpr variables
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Constexpr variables are not implicitly inline, Try including the header in two translation units without the Additionally, this PR does not do much. This doesn't fix any warning or errors, and doesn't add any feature, so I'm not sure what the purpose is. |
These changes wouldnt be made here anyway; the unicode_emojis.h is auto generated so any changes made directly to the file will be dropped. |
Sounds like a good idea! |
No, constexpr variables are variables, you can take their address. What ASM the compiler generates has nothing to do with this and especially with optimizations enabled. As i said, try including the header without the inline in two translation units. Header guards also have nothing to do with this. |
but have you tried it, in dpp? also, did you read the bit about this entire file being auto generated? Running cmake with all the correct dev depenencies will overwrite your changes. |
Not sure what you mean by 'what ASM the compiler generates has nothing to do with this', this is about how compilers handle
You mentioned multiple definition errors which are non-existent on constexpr variables I do agree i was wrong on the usage of #pragma once though, an error will be thrown on non-
compiled w/ x64-clang-debug on a win32 machine, did not break anything because it simply does not change how clang (or any compiler for that matter) reads the file |
No, it's not. The compiler or linker will do that replacement when it can, inline or not, it has nothing to do with this. |
constexpr
variables are evaluated at compile time, rendering theinline
andconst
keywords useless since they don't persist in memorythis is only beneficial for file size as
constexpr
takes priority over other keywords (so probably the lowest priority pull request yet)Code change checklist