Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In what way? I haven't had the opportunity to try it out myself yet.


It is a feature that sounds like it promises to make something compile time but it doesn't. At the same time it has a bunch of limitations, that in no way reflects what modern compilers can do. Plenty of times you can write an expression and if you say its a constexpr, the compiler is forced to tell you that its not a valid constexper, but if you just remove the constexper qualifier, the compiler the compiler can solve the expression at compile time just fine. So using constexpr gives you:

-No guarantee that its computed at compile time. -Limits what the compiler lets you do when using the constexper keyword. -Adds no performance benefits or guarantees. -Makes your code not portable to most C compilers.

On top of this it adds implementation burden for compiler, and complicates the specification significantly.


Gotcha. To be honest, this description sounds like what constexpr is in C++ as well, and various `const` things in Rust. I thought you were saying that the feature doesn't work, but it sounds more like you don't like how the feature was designed. Thank you for letting me know!


Well, its broken in the sense that one part of the standard describes some functionality, and then an other part of the standard, says "Oh you can ignore that."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: