4 ms·
Another quote: C++ most suited for demanding systems applications. [...] You choose C++ when the situation is already complicated. ... and then you have t
by Nitramp 12y ago
Another quote:
C++ most suited for demanding systems applications. [...] You choose C++ when the situation is already complicated.
... and then you have two problems </snark>. Yes, C++ has a lot of features, and those features are often individually useful to solve individual issues, but I remain unconvinced that this plethora of features and complexity pull their own weight.
You can write useful, efficient software in languages that expose much less complexity to their users.
Re: complexity. Not having to understand C++ most of the time, or subsetting the language to have a manageable code base only works until you run into somebody else's code, or some 3rd party library. It's not a fix, it's a symptom of something broken.
- GFK_of_xmaspast 12y ago"C-with-STL-containers" is an incredibly powerful subset of C++.
- loup-vaillant 12y agoWhich is why I'm seriously tempted to add a simple template system on top of C (it has already been done, by the way), then implement containers on top of that. With that, I get the power without the rabbit hole.
- bcoates 12y agoWouldn't it just be simpler to fuse off the part of your linker that handles vtables? IIRC That'll kill every C++ feature that's objectionable to someone who likes the idea of 'C with templates' Unless you want a truly simple C template system, in which case aren't the C11 type sensitive macros sufficient?
- loup-vaillant 12y ago> C11 type sensitive macros Hey, that sounds cool. Do you have a link? A quick search doesn't seem to work. The vtables on the other hand I will steer clear from. Closures are way more useful than class based polymorphism. Combine it with parametric polymorphism (templates), and you won't need to subclass anything ever again —okay, I'm exaggerating a little.
- LukeShu 12y agoLook for the "_Generic" keyword. On that topic, it is possible to do cool things with macros with GCC extensions. A simple example of generic macros was discussed about a week ago: https://news.ycombinator.com/item?id=7896280 https://news.ycombinator.com/item?id=7896280
- loup-vaillant 12y agoThanks. Doesn't look like that's enough for my purposes, though.
- yoklov 12y agoIt's called _Generic (which should be easier to Google), but the fact that you have to modify the macro wherever you want to use it with a new type severely limits its usefulness.
- blt 12y agoAren't std::functions effectively using something like vtables though?
- loup-vaillant 12y agostd::function looks like a regular template class (like any container). And It doesn't look like we should subclass it. So, unless I'm missing something, there is no vtable.
- Sharlin 12y agostd::function is usually implemented using subtype polymorphism internally.
- loup-vaillant 12y agoOkay… By the way, why do we need std::function at all? Every time I saw it, it was to work around some dark corner of C++ type system or template dark magic.
- robmccoll 12y agoThis is how C++ started. See cfront. http://en.m.wikipedia.org/wiki/Cfront http://en.m.wikipedia.org/wiki/Cfront
- mpyne 12y agoThe point is that sometimes you need the added complexity to solve complex problems. Torque wrenches are more complicated than a socket wrench, which is itself more complicated than a simple $5 wrench. But when you need to be able to precisely measure running torque or torque a fitting to known value, you can't avoid picking up the complexity of a torque wrench.