KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Would you replace const int one = 1; const int two = 2; with this? constexpr int one = 1; constexpr int two = 2; Is my understanding correct that both blocks are semantically identical and that it is currently merely a matter of taste? On the other hand, as constexpr implies const , you could argue that it is more consistent to always prefer the more restrictive form, even in trivial situations where it does not make a difference? (I understand that the situation completely changes when the expression on the right side are allowed to be more complicated. So for clarification, the question only focuses on the most simple case where the expression is a fixed integer number.)
Tags (comma-separated)
Save Edits
Cancel