Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > problem with strings

Thread Tools

problem with strings

Neil Cerutti
Posts: n/a
On 2006-01-05, Removed) <(E-Mail Removed)> wrote:
> Ben Pope wrote:
>> std::string is much easier to use correctly than char*.

> Yes.
>> Surely the basics are std::strings, and the complicated bits
>> are arrays, resource management, and pointers?

> Sort of.. (see below)
>> Only when somebody is at ease with the basics, should they progress to
>> the more advanced topics of pointers, arrays and resource management.

> The "usage" of std::strings is easier than char* of course. But
> std::string hides implementation details and simple language
> mechanism's (buffer allocation and deletion etc) that the
> developer should be familiar with in order for them to apply
> such mechanism's to their own classes and algorithms.

That's why learning std::string before char* is so valuable. It
exposes new C++ programmers to a major C++ abstraction mechanism.
Learning it the other way around may be a disservice. The ability
to program in Brainf**k is very important in C++, but you don't
have to learn it first.

> The concept of arrays may be more advanced, but a character
> array is IMHO the simplest, most concrete way to explain those
> features and visualize them. It's much easier to explain an
> array of chars than an array of X objects.

I agree that eventually you need to understand these concepts.

Neil Cerutti
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strings, Strings and Damned Strings Ben C Programming 14 06-24-2006 05:09 AM
How to generate k+1 length strings from a list of k length strings? Girish Sahani Python 17 06-09-2006 11:01 AM
Catching std::strings and c-style strings at once Kurt Krueckeberg C++ 2 11-17-2004 03:53 AM
convert list of strings to set of regexes; convert list of strings to trie Klaus Neuner Python 7 07-26-2004 07:25 AM
Comparing strings from within strings Rick C Programming 3 10-21-2003 09:10 AM