News for hackers. Stuff that matters.
Re:C++17 constexpr everything, or as much as the compiler can by tambre on Thursday December 28, 2017 @10:59AM (#16022720)
> A constexpr is a constant that is evaluated from a code at compile time, [...]

It's rather a constant expression, which is quite a bit more than a mere constant.

> [...] which is essentially just macros. Right?

Macros are basically just text replacement. You can't write a macro and expect most compilers to execute the expressions and code inside the macro at compile-time. Some compilers may still to do that, but it's not very common for more complicated stuff. With constexpr you get a guarantee that the expression can be evaluated at compile-time and it gives quite a good hint to the optimizer to spend more time optimizing that portion of the code.

Re:C++17 constexpr everything, or as much as the compiler can by hzhou321 on Friday December 29, 2017 @02:54AM (#16028298)
With a macro, you get guarantee of compile time evaluation, as well as compile time independent literal syntax double check. And you can do better than hint. You can double check the results explicitly. Since it's compile time evaluation, optimization is out of context.
Re:C++17 constexpr everything, or as much as the compiler can by tambre on Saturday December 30, 2017 @10:08AM (#16035534)
If you call searching and text replacement evaluation, then sure.
Re:C++17 constexpr everything, or as much as the compiler can by hzhou321 on Saturday December 30, 2017 @07:29PM (#16038549)
It can be more than that.