[haiku-commits] Re: r36952 - in haiku/trunk: headers/os/app src/bin src/kits/app src/servers/notification

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 27 May 2010 23:06:15 +0200

Stephan Assmus <superstippi@xxxxxx> wrote:
> On 2010-05-27 at 21:50:59 [+0200], Karsten Heimrich <host.haiku@xxxxxx> 
> > wrote:
> > (1) I wonder if we shouldn't use const BString& string while 
> > introducing
> > new API's? I know all the old API's use const char*, but memory an 
> > speed
> > are not really a constraint here, no?
> I am usually in favor of that since you introduced the COW BString 
> backend. 
> However in this case, these methods can actually unset the members by 
> passing 
> NULL. Granted, it's not different from passing "" or an empty 
> BString. I can 
> definitely change it, it wouldn't make a difference besides avoiding 
> string 
> copies.

Since the target is in fact a BString, it cannot really be more 
expensive than passing a const char* - but it can be cheaper.
But I think it's hard to find a consistent approach to this, since 
sometimes it's a lot cheaper to pass in const char* - maybe we should 
always just have both versions in our future APIs.

Bye,
   Axel.


Other related posts: