3 ms·
The big reason for avoid C++ is to avoid bugs and security issues. In particular, overflow attacks. That the language requires constant, conscious diligence to
by jacques_chester 15y ago
The big reason for avoid C++ is to avoid bugs and security issues. In particular, overflow attacks. That the language requires constant, conscious diligence to achieve a security baseline that comes for free in other languages is wasteful.
Then there's the library/tools situation. I did all the work for my honours dissertation in Ruby in part because the Ruby ecosystem is vast and vibrant (sometimes inconveniently so).
I imagine that the C++-for-the-web ecosystem is going to be a bit more spartan.
- VikingCoder 15y ago> That the language requires constant, conscious diligence to achieve a security baseline that comes for free in other languages is wasteful. For extremely expensive values of "free."
- jacques_chester 15y agoCould you elaborate?
- VikingCoder 15y agoNo language exists yet that is aware of all security issues. No matter what language, library, framework, toolset you use, you need to be aware of multiple vectors of attack. Claiming that some languages solve these problems for you, for free, is disingenuous.
- jacques_chester 15y agoThat's not what I claimed. I pointed out that languages with safe string handling and memory management have a higher security baseline. As in, what you start with, for "free". Achieving comparable string and memory security in C/C++ is an expense. You must take active steps to prevent those exploits; and even then human error means that you will have a higher risk than the "free baseline" languages.
- deleted 15y ago[deleted]
- daemin 15y agoDo you actually mean C? Since in C++ you can use STL classes for buffers where they are automatically resized as appropriate, streams for IO, etc. So you'd effectively have the same resizing and safe objects to work with as in a higher level language. As far as I see it both C++ and Ruby have a similar amount of libraries that can be used, they both have a major web framework, Rails for Ruby and OKWS for C++, and there's probably a plethora of smaller frameworks and helpers available for each language. Rails may seem like it would be winning (versus C++) on the ecosystem, but that's because there's so many hip gems for Rails out there, but if you take a look at all libraries it probably won't be so.
- jacques_chester 15y agoI mean both, though OP addressed C++. And you've proved my point. Proper use of carefully-written classes will reduce the risk of a buffer overflow -- but you will need to exercise additional vigilance ("Make sure you use STL! Why isn't this code using STL?" etc), over and above addressing the problem, to ensure string safeness is assured. That's a dead loss that programmers in memory-safe languages simply don't have to pay for the same level of confidence.
- daemin 15y agoI consider the STL to be (essentially) part of the language, hence to program without it, isn't really programming C++ anymore. This is especially true since the introduction of C++11, where the STL enables many language features. Essentially a string is std::string, a resiable buffer is std::vector<unsigned char>, and for a string or a resiable (or unknown size) buffer to be anything else you need to provide a very good reason. I would also be careful with Ruby since a lot of (performance specific) gems and plugins for Rails are written in C, and hence potentially suffer the same problems that one is trying to avoid by using Ruby. Or at least you end up in the same boat if you were using C or C++ to begin with.