3 ms·
"What's wrong with rolling a string class, adding a member or two?" The fact that it's 2010? A language and its standard library are theoretically different t
by jdminhbg 16y ago
"What's wrong with rolling a string class, adding a member or two?"
The fact that it's 2010?
A language and its standard library are theoretically different things, but in any practical sense, the choice to use a language carries with it the choice to use its standard library. Additionally, the way the standard library is usually reflects constraints placed on it by its language. Java, for example, has a verbose and ceremonial standard library, and that's not a coincidence.
- DanielBMarkham 16y agoAnd the fact that it is 2010 relates exactly how to wrapping character array functions? Because I'm not following. If you're in C and using strings, it's still 1985 for you too. There may be a larger argument about whether the various standards bodies have so complicated C++ that it's become unwieldy -- the comment about exceptions in destructors has merit. But that's not the argument he was making. Good programmers are good because of the things they don't do. It's the guys who want to use every feature and library that are often the ones creating the disasters the rest of us have to maintain. So yes, the features and such of a language can hurt. But that's true of just about any language save some of the hardcore functional ones -- C++ maybe more so than the rest. Being a coder using modern languages means judicious use of complexity. Simple is almost always better. Which is exactly where he's coming from, he just takes his argument too far. In fact, one of the things C++ teaches you early on -- or you suffer all sorts of pain -- is when to abstract, when not to, when to use libraries, when not to, and the dangers of frameworks. It's the very fact that it's such a complex monster that forces coders to keep it simple, stupid. You don't get that kind of thing out of the box in something like Java. This is more bad than good in terms of delivering solutions, but it also is not all bad. It has merit because it trains programmers about the kinds of disasters they can make. If you can write good, easily understood and maintainable C++ code, I can trust you with about anything. If the first thing you do is jump in the swamp where all the alligators live simply because you can -- templates, large inheritance trees, etc -- then probably not so much.
- blub 16y agoThe C++ standard library and std::string implicitly have specific constraints and use cases, but they were imposed by the design process, not by the language. C++ has many string types because each string type has its strengths and weaknesses. For instance, QString is a fully-featured and Unicode-aware string written in C++ that I use most of the time. std::string is good for most things. What are your specific issues with it?
- jdminhbg 16y agoI don't write C++ and have no issue with std::string. I was taking general issue with the OP's general issue with criticizing a std library alongside a language.
- deleted 16y ago[deleted]
- nuxi 16y agoA proper s[n]printf()-like functionality would be more than nice. No ostringstream crap, no boost's format() hacks, just plain sprintf().
- edanm 16y ago"A language and its standard library are theoretically different things, but in any practical sense, the choice to use a language carries with it the choice to use its standard library." That's less true when talking about C/C++ than other languages. C/C++ are quite often used in embedded systems, which often have problems with dynamic memory allocation, code size, etc. This means that many embedded systems don't use the standard library, or only use portions of it.