Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Do 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.



I 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.


I 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: