4 ms·
How does the extra functionality impact the final binary ? Or do the compilers add extra things you don't need even if you don't use them ?
by Qantourisc 11y ago
How does the extra functionality impact the final binary ? Or do the compilers add extra things you don't need even if you don't use them ?
- m_mueller 11y agoC lang has certain features that C++ doesn't. Most notably the "restrict" keyword to make the compiler aware that you don't intend to alias a pointer. AFAIK there is no portable way to do this in C++. This is relatively important feature in HPC. So yeah, I'd very much support the idea of "C plus templates", at least in my field this would get a lot of usage.
- Narishma 11y agoThe feature may not be in the C++ standard but the main compilers support it anyway (__restrict__ in GCC and Clang, __restrict in MSVC).
- mbel 11y agoMost of the C++ features does not require compiler to add anything extra to the binary, there are however some exceptions from this rule, e.g. exceptions (no pun intended) and RTTI. The biggest problem with using full C++ as C + <small subset of C++ features> is that at some point people will stop writing in C style and start to use STL and design code using C++ idioms. You can probably try to fight this with coding standards, linters and other tools but policing people will require some additional effort.
- bsenftner 11y agoJust never put STL into your environment. What's what I've seen at a number of C purist dev shops. At first, younger C++ developers complain about the missing STL, but if they actually know how to write the algorithms STL provides, their complaints die after some ribbing from the old guys. It's actually something of beauty when a developer realizes how much of a crutch STL had been to them, and the ease of working without it. Code complexity reduces too, because STL seems to encourage creating complexity over simplicity. Teah, it's not supposed to be that way, but we live in the real world.
- catnaroek 11y agoI'll be the last one to say the STL (or, rather, its standard library port) is pretty, but damned should I be if I need to reimplement the same data structures and algorithms over and over. Parametric polymorphism is something every statically typed programming language should have in 2015. I'm aware templates aren't quite parametrically polymorphic, but it's still better than nothing.
- deleted 11y ago[deleted]