Back when I made this, GCC/clang were crashing left and right while compiling my project because of constexpr and auto usage with nested lambdas. It got worse with every template being evaluated until the compiler and my IDE started crashing.
I was making a react-like UI component library with all the new bells and whistles of modern C++. It was fun at first then the issues cropped up and it kinda killed my passion for the language and drove me away entirely.
I see. I think auto gets overused a lot by people just being lazy about writing out the full type, but constexpr is good practice in my opinion. Never had a compiler issue with them, but then I don’t think I’ve ever used a nested lambda either.
I really like C++ (I know, shoot me), and I think auto should be avoided at (almost) all costs.
One of the things I love about a language like C++ is that I can take one glance at the code and immediately know what types I’m working with. auto takes that away while adding almost no benefit outside of a little convenience while writing.
If I’m working with some very big template type that I don’t want to write out, 99/100 times I’ll just have a using somewhere to make it more concise. Hell, I’ll have using vectord = std::vector<double> if I’m using a lot of them, because I think it makes the code more readable. Just don’t throw auto at me.
Of course, the worst thing ever (which I’ve seen far too often) is the use of auto in examples in documentation. Fucking hell! I’m reading the docs because I don’t know the library well! When you first bother to write examples, at least let me know the return type without needing to dig through your source code!
What’s wrong with constexpr?
Back when I made this, GCC/clang were crashing left and right while compiling my project because of constexpr and auto usage with nested lambdas. It got worse with every template being evaluated until the compiler and my IDE started crashing.
I was making a react-like UI component library with all the new bells and whistles of modern C++. It was fun at first then the issues cropped up and it kinda killed my passion for the language and drove me away entirely.
Not sure about its state nowadays though.
I see. I think auto gets overused a lot by people just being lazy about writing out the full type, but constexpr is good practice in my opinion. Never had a compiler issue with them, but then I don’t think I’ve ever used a nested lambda either.
I really like C++ (I know, shoot me), and I think
autoshould be avoided at (almost) all costs.One of the things I love about a language like C++ is that I can take one glance at the code and immediately know what types I’m working with.
autotakes that away while adding almost no benefit outside of a little convenience while writing.If I’m working with some very big template type that I don’t want to write out, 99/100 times I’ll just have a
usingsomewhere to make it more concise. Hell, I’ll haveusing vectord = std::vector<double>if I’m using a lot of them, because I think it makes the code more readable. Just don’t throwautoat me.Of course, the worst thing ever (which I’ve seen far too often) is the use of
autoin examples in documentation. Fucking hell! I’m reading the docs because I don’t know the library well! When you first bother to write examples, at least let me know the return type without needing to dig through your source code!https://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/