C++26: The Oxford Variadic Comma
www.sandordargo.com - 57 poäng - 22 kommentarer - 391289 sekunder sedan
Kommentarer (8)
- staplung - 5086 sekunder sedanOf course since the old syntax is merely deprecated and not removed, going forward you now have to know the old, bad form and the new, good form in order to read code. Backwards compatibility is a strength but also a one-way complexity ratchet.
At least they managed to kill `auto_ptr`.
- mFixman - 6358 sekunder sedanI used to slay with this in code golfing competitions from TopCoder, where you had to implement a function to solve a particular problem, thanks to C pointer maths and the gcc generally putting function arguments in order in the stack.
Turns out, these two are equivalent in practice (but UB in the C++ standard):
double solve(double a, double b, double c, double d) { return a + b + c + d; } double solve(double a ...) { return a + 1[&a] + 2[&a] + 3[&a]; } - advael - 6355 sekunder sedanThis seems pretty good to me just on the level of trying to read C as someone using C++. Parameter packs and variadic templates are easily the most confusing syntax in C++ and cleaning it up is... very welcome
- blueaquilae - 545 sekunder sedanI'm far from C++ but reading this article confused be, from the form to the impact to the dead link https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p12...
I guess that's a preview how C++ require a lifelong commitment.
- zlfn - 4910 sekunder sedanC++ seems to be constantly getting complicated. If the major version were to change, there wouldn't be any need for backward compatibility with the existing code, and it would have been okay to delete that syntax while creating an automatic formatter.
- HackerThemAll - 3657 sekunder sedanYes, but no. I learned C++ in '90s when it was C with classes and some other noise added by Stroustrup. During the some 25 years that followed it had became a mess that's insanely hard to work with. I'm not going back to this language. I prefer plain C or Rust, leaning towards Rust when I fully comprehend the lifetime and borrow checker. Or when I have the luxury of having a GCed runtime, then the .NET with its easiest C# language with wonderful abundance of great libraries is the best choice. Nobody was ever fired for using .NET (for right purposes).
- lasgawe - 5945 sekunder sedanlearned something new. thanks for the article.
- throwaway2027 - 5647 sekunder sedanC++ got too complicated after C++23 I went back to C.
Nördnytt! 🤓