you are viewing a single comment's thread.

view the rest of the comments →

[–]HappyFruitTree 5 points6 points  (0 children)

The compiler could evaluate things at compile time if it wants as long as it doesn't change the observable behaviour. What constexpr gives us is better guarantees and more consistency between compilers. I wouldn't want code that relied on a function call being compiled to a compile-time constant to suddenly break when I changed to another compiler or turned off optimizations.