By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

String or char[] - that is the question

P: n/a
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
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Fri, 07 May 2004 19:51:25 GMT, Mateusz Łoskot
<an******@see.my.signature> 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
Jul 22 '05 #2

P: n/a
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
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.