Re:Non-constant constant-expressions in C++
by MaulingMonkey on Sunday April 26, 2015 @05:27PM
(#9443333)
> Articles like this are one of the reasons I don't profess to know C++ well.
...any why I profess nobody knows C++ well, even those on the standards committee ;)
Re:Non-constant constant-expressions in C++
by karmakaze on Monday April 27, 2015 @08:42AM
(#9445816)
The demonstrated result is unfortunate, but shouldn't really surprise anyone with a history of C++. 'Template' happens. Attempts to eliminate all such curiosities will only make the language larger and more complex, expanding the cycle.
> instead have a genuine compile-time macro language
Yep. Jesus christ why didn't they do this. Going further, D (or more recently, JAI) style CTFE would have been great.
But no such luck.
This is not a good advertisement for C++. It would have been much healthier to not have had such a powerful and under-researched template instantiation mechanism, and instead have a genuine compile-time macro language. It's hard to see a way back though. Everything added - like constexpr functions - to make compile-time execution more sane, can be put back into the mix to complect things even further.