Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > return string

Thread Tools

return string

James Kanze
Posts: n/a
On 18 avr, 13:58, Pete Becker <(E-Mail Removed)> wrote:
> On 2008-04-18 04:24:05 -0400, James Kanze <(E-Mail Removed)> said:
> > And maybe it's not. And maybe copying the value is fast
> > enough. Until you actually have a performance problem, and
> > the profiler indicates that it is due to copying the string,
> > it's stupid to worry about it.

> That depends on context. Certainly, when you're writing an application,
> spending time optimizing things that aren't bottlenecks is a waste of
> time. But when you're writing a general purpose library that's going to
> be distributed to others, if you don't spend time optimizing things,
> you'll spend time responding to complaints from users that your code is
> too slow. If that's just an internal feedback loop, fine; but if you're
> not part of your users' development process, you'd better put the time
> in up front.

I'll admit that library implementers have it tough, here. They
do have to do some guessing, and (for example) were I
implementing the standard library, I'd certainly make sure that
std::vector<>:perator[]() was as fast as possible. Without
waiting for feedback from actual users.

Still, given the apparent level of the original poster, I don't
think he's implementing a standard library. First things first,
and all that. Until you know how to write correct code, you
shouldn't worry about optimization (and you probably shouldn't
be writing libraries for widespread use).

James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Reply With Quote

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
Javadoc including "java.lang.String" instead of just "String" for return values Randolf Richardson Java 2 02-03-2007 07:14 AM
Search a Text File for a String, Return String to Function Perl Misc 1 07-29-2006 10:14 PM
Carriage Return added during return of large string from class method Xeno Campanoli Ruby 0 02-13-2006 08:39 PM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM
Web Services return string: An XML string DotNetGruven ASP .Net Web Services 3 06-30-2004 06:48 PM