String or char[] - that is the question

  • Thread starter =?ISO-8859-2?Q?Mateusz_=A3oskot?=
  • Start date
?

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

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
 
L

Leor Zolman

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top