8 ms·
I work in C++ daily and there is something about the simple-ness of C that I love. You get out of magical hell that is templates and return to simple flat-func
by darknavi 4y ago
I work in C++ daily and there is something about the simple-ness of C that I love. You get out of magical hell that is templates and return to simple flat-functions and macros.
- LeSaucy 4y agoHot take: people make a bigger deal of how complex templates are. Modern compilers find and describe errors much better than in the days of trying to use boost in vc6.
- orlp 4y agoTemplates suck because they're the wrong abstraction. Or rather, they pretend to be an abstraction when in reality they're leaky as hell. Rust's traits are generics done right. I haven't looked at Concepts too much, I hope that they'll be better than templates.
- pjmlp 4y agoThey are, the best ISO C++ alternative is ISO C++ vnext.
- DeathArrow 4y agoYou can take a look at C# generics. They are quite simple.
- webmobdev 4y agoD is more appealing and powerful, and if you are familiar with C/C++ there's not much of a learning curve - https://dlang.org/overview.html https://dlang.org/overview.html
- pjmlp 4y agoNothing prevents you to code like that in C++, although I would rather suggest templates instead of macro hell.
- huhtenberg 4y agoThat's the thing with C and C++. C is light and simple, but don't use it much, because it can get too verbose. C++ allows for succinct code, but it's neither light or simple. Nor does it have any concern for the elegance of its design. Hence the common practice of using a small subset C++ and pretending it's just C with Extras.
- einpoklum 4y ago> Nor does it have any concern for the elegance of its design. It has a lot of inelegant facilities, which, when used under the hood, allow you to express your elegant abstractions. > Hence the common practice of using a small subset C++ and pretending it's just C with Extras. That's mostly failure to use C++. Since C++11, and especially with later updates to the standard, idiomatic C++ is very different from C - even if you're not using a lot of the standard library. I'll link to a talk already linked-to in another comment in this discussion: Rich code for tiny computers / Jason Turner, CppCon 2016 https://www.youtube.com/watch?v=zBkNBP00wJE https://www.youtube.com/watch?v=zBkNBP00wJE
- _gabe_ 4y ago> That's mostly failure to use C++. Isn't this the no true Scotsman fallacy? It looks like you're agreeing with the parent poster that a lot of people use a small subset of C++ to pretend that it's C with extras. If this is true, it's not a failure of all these people because they don't _really_ understand C++. It's a failure of the language designers because they have made something that nobody can agree on how to use.
- einpoklum 4y agoI should have used a different word. I meant "failure to do X" as in "not doing X", not as in "lack of success in the attempt to do X" See the two meanings here: https://dictionary.cambridge.org/dictionary/english/failure https://dictionary.cambridge.org/dictionary/english/failure
- huhtenberg 4y ago