String or char[] - that is the question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mateusz £oskot

    String or char[] - that is the question

    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
  • Leor Zolman

    #2
    Re: String or char[] - that is the question

    On Fri, 07 May 2004 19:51:25 GMT, Mateusz £oskot
    <antispam@see.m y.signature> wrote:
    [color=blue]
    >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[/color]

    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:
    On-Site Legacy C++ Training for programmers, delivered by Leor Zolman. An outline of the programmer training seminars to be delivered at your location.


    -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:
    An STL Error Decryptor for C++ by Leor Zolman of BD Software - available to download here

    Comment

    • Mateusz £oskot

      #3
      Re: String or char[] - that is the question

      On 5/7/2004 10:43 PM, Leor Zolman wrote:[color=blue]
      > 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[/color]

      Thanks, great article.

      Regards

      --

      Mateusz £oskot
      mateusz at loskot dot net

      Comment

      Working...