Added c++17 if constexpr to reduce code size and fix MSVC warning#88
Added c++17 if constexpr to reduce code size and fix MSVC warning#88cameron314 merged 1 commit intocameron314:masterfrom ivysnow:master
Conversation
|
What is the advantage of using constexpr if here? I thought the compiler would optimize out the constant conditionals regardless... |
|
When disable optimization (with /Od), Microsoft Visual C++ generate a instruction sequence "mov/test/je/jmp" and code for both branches, it also generate a "warning C4127" when we enable warning level 4 (with /W4). |
|
Fair points. Not quite ready to move to C++17, but I'll keep this open until then. |
|
@cameron314 , @ivysnow has not moved the code to C++17, it is a conditional compilation. It is 2020 Q1 and C++20 is about to be officially supported by all the relevant compilers. Are you ready now to move to C++17? |
|
Alright, keep your shirt on :-) |
|
Merged using command line. Don't know why it's not showing in the UI. |
I use c++17 [if constexpr] stmt to reduce code size, and fix some MSVC warning in /std:c++latest mode.