inefficient QString coding practice
Lars Knoll
lars at trolltech.com
Sun Mar 14 14:03:07 GMT 2004
On Saturday 13 March 2004 20:05, Tobias Koenig wrote:
> On Sat, Mar 13, 2004 at 07:35:21PM +0100, Lars Knoll wrote:
> > On Saturday 13 March 2004 15:02, Harri Porten wrote:
>
> Hi Lars,
>
> > We actually know about this problem and already have a solution for this
> > in Qt 4. It's called QLatin1String and is a simple wrapper around a const
> > char *.
> >
> > So you can then write
> >
> > if(str == QLatin1String("foo")) { ... }
>
> Hmm, and you think the lazy developer will type 'QLatin1String' for
> every short "foobar" string?!?
> Can't we use a shorter name? Such a long name disturbs the whole code
> layout.
Currently we have QString::fromLatin1(...). Is that better?
You can always use a typedef if you think the length is really disturbing. I
still prefer long but descriptive names to short but unclear ones.
Lars
More information about the kde-core-devel
mailing list