As for reallocation and dynamic buffers.... I would use a C++ resizable type if I needed a resizable type.
Along with a few other things:
C (programming language) - Wikipedia, the free encyclopedia
So I don't buy that as a reason at all.
Wiki does add:
"C has also been widely used to implement end-user applications, but much of that development has shifted to newer languages."
It seems reasonable that people would move to newer languages if they provide more features -- as C++ does over C. That's fine, but it doesn't imply anything about the suitability of C.
I agree that std::string removes causes of common bugs with char* strings. I agree that having the memory allocation taken care of by the class is useful,
I'll try using this next time I need to do something with a string. I'm not hot on the idea of having to create a StringStream every time I want to do an
C stdio (especially scanf) takes a bit of getting used to and can be pretty annoying. I expect this'll have its own raft of slightly odd seeming behaviour to get used to. Guess that 's a good reason to get familiar with it.
I suppose it's easily done. I've done it a few times (especially forgetting to put Null at the end of strings), but have always realised when the output wasn't what I expected.Originally Posted by grumpy
Ha, I could see myself copying the c_str out of a string and manipulating it. I think at that point it's time to ask yourself some serious questions about why you're missing the point so badlyOriginally Posted by grumpy
Yes, exactly. You put that a lot better than I didOriginally Posted by grumpy
I'm not great with high level abstractions -- depends how abstract they are. The library function descriptions don't seem too bad -- not so abstract that my brain rejects them as incomplete. Probably helps that I've seen use of Lists and Vectors and stuff in real code many times.