[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: inefficient QString coding practice
From:       Adriaan de Groot <adridg () sci ! kun ! nl>
Date:       2004-03-14 15:08:04
Message-ID: Pine.GSO.4.44.0403141604290.10319-100000 () wn4 ! sci ! kun ! nl
[Download RAW message or body]

On Sun, 14 Mar 2004, Simon Hausmann wrote:
> On Sunday 14 March 2004 15:34, Tobias Koenig wrote:
> > > Currently we have QString::fromLatin1(...). Is that better?
> >
> > No, and that's the only reason why I never use it ;)

#define CSL1(a) QString::fromLatin1(a "")

That's short for "const string latin 1" and all you can feed it are string
constants (the "" is a weird kind of check for that). Useful for marking
strings as such, and can be redefined (to just a) as needed. I use it all
the time, but then again, I use QT_NO_* as well, since I _need_ to be
picky about encodings in my app.

> Really, how often do you have to write it?
>
> QLatin1String is for corners in library development. Most of the time
> if ( bleh == "foo" ) doesn't really matter performance wise, in an
> application.

The original claim by Juergen was that bleh == "foo" incurs a considerable
malloc / free and whatnot overhead and that it should be kept in mind. As
long as there's no numbers attached, neither "doesn't really matter
performance-wise" or "is important" can be evaluated.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic