Skip to content

Added c++17 if constexpr to reduce code size and fix MSVC warning#88

Merged
cameron314 merged 1 commit intocameron314:masterfrom
ivysnow:master
Jan 30, 2020
Merged

Added c++17 if constexpr to reduce code size and fix MSVC warning#88
cameron314 merged 1 commit intocameron314:masterfrom
ivysnow:master

Conversation

@ivysnow
Copy link
Copy Markdown
Contributor

@ivysnow ivysnow commented Sep 12, 2017

I use c++17 [if constexpr] stmt to reduce code size, and fix some MSVC warning in /std:c++latest mode.

@cameron314
Copy link
Copy Markdown
Owner

What is the advantage of using constexpr if here? I thought the compiler would optimize out the constant conditionals regardless...

@ivysnow
Copy link
Copy Markdown
Contributor Author

ivysnow commented Oct 9, 2017

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).

@cameron314
Copy link
Copy Markdown
Owner

Fair points. Not quite ready to move to C++17, but I'll keep this open until then.

@DBJDBJ
Copy link
Copy Markdown

DBJDBJ commented Jan 29, 2020

@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?

@cameron314
Copy link
Copy Markdown
Owner

Alright, keep your shirt on :-)
I'll merge next time I have a minute.

@cameron314
Copy link
Copy Markdown
Owner

Merged using command line. Don't know why it's not showing in the UI.

@cameron314 cameron314 merged commit e68850f into cameron314:master Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants