Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > String or char[] - that is the question

Reply
Thread Tools

String or char[] - that is the question

 
 
=?ISO-8859-2?Q?Mateusz_=A3oskot?=
Guest
Posts: n/a
 
      05-07-2004
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
 
Reply With Quote
 
 
 
 
Leor Zolman
Guest
Posts: n/a
 
      05-07-2004
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
 
Reply With Quote
 
 
 
 
=?ISO-8859-2?Q?Mateusz_=A3oskot?=
Guest
Posts: n/a
 
      05-07-2004
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
 
Reply With Quote
 
 
 
Reply

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
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Is "String s = "abc";" equal to "String s = new String("abc");"? Bruce Sam Java 15 11-19-2004 06:03 PM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM
String.replaceAll(String regex, String replacement) question Mladen Adamovic Java 3 12-05-2003 04:20 PM
Re: String.replaceAll(String regex, String replacement) question Mladen Adamovic Java 0 12-04-2003 04:40 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57