String or char[] - that is the question

Discussion in 'C++' started by =?ISO-8859-2?Q?Mateusz_=A3oskot?=, May 7, 2004.

  1. Hi,

    Simple question, in STL compatible application
    should one use std::string or char[] / char*
    types for working with strings ?

    How to make decision ? What rulse should I consider ?

    It may be a very trivial, but I ask for some others experience
    rather than for explanation of 'How to use strings' ?

    Thanks & regards

    --

    Mateusz £oskot
    mateusz at loskot dot net
     
    =?ISO-8859-2?Q?Mateusz_=A3oskot?=, May 7, 2004
    #1
    1. Advertising

  2. =?ISO-8859-2?Q?Mateusz_=A3oskot?=

    Leor Zolman Guest

    On Fri, 07 May 2004 19:51:25 GMT, Mateusz £oskot
    <> wrote:

    >Hi,
    >
    >Simple question, in STL compatible application
    >should one use std::string or char[] / char*
    >types for working with strings ?
    >
    >How to make decision ? What rulse should I consider ?
    >
    >It may be a very trivial, but I ask for some others experience
    >rather than for explanation of 'How to use strings' ?
    >
    >Thanks & regards


    char *'s may save you a bit of memory and run a teeny bit faster if you
    code them optimally; all the other factors (clarity, maintainability,
    modularity, cost to develop, cost to debug, etc.) are in std::string's
    favor. Here's a case study:
    http://www.bdsoft.com/resources/thinking.html

    -leor


    --
    Leor Zolman --- BD Software --- www.bdsoft.com
    On-Site Training in C/C++, Java, Perl and Unix
    C++ users: download BD Software's free STL Error Message Decryptor at:
    www.bdsoft.com/tools/stlfilt.html
     
    Leor Zolman, May 7, 2004
    #2
    1. Advertising

  3. On 5/7/2004 10:43 PM, Leor Zolman wrote:
    > char *'s may save you a bit of memory and run a teeny bit faster if you
    > code them optimally; all the other factors (clarity, maintainability,
    > modularity, cost to develop, cost to debug, etc.) are in std::string's
    > favor. Here's a case study:
    > http://www.bdsoft.com/resources/thinking.html


    Thanks, great article.

    Regards

    --

    Mateusz £oskot
    mateusz at loskot dot net
     
    =?ISO-8859-2?Q?Mateusz_=A3oskot?=, May 7, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wwj
    Replies:
    7
    Views:
    587
  2. wwj
    Replies:
    24
    Views:
    2,556
    Mike Wahler
    Nov 7, 2003
  3. Ben Pfaff
    Replies:
    5
    Views:
    493
    Tristan Miller
    Jan 17, 2004
  4. Steffen Fiksdal

    void*, char*, unsigned char*, signed char*

    Steffen Fiksdal, May 8, 2005, in forum: C Programming
    Replies:
    1
    Views:
    615
    Jack Klein
    May 9, 2005
  5. lovecreatesbeauty
    Replies:
    1
    Views:
    1,121
    Ian Collins
    May 9, 2006
Loading...

Share This Page