[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-utils-devel
Subject: question regarding QLatin1String and QLatin1Char
From: Evan Teran <evan.teran () gmail ! com>
Date: 2012-08-06 21:43:28
Message-ID: CANJCGtJO7beKP1Rjnhb=2WbzmrsxwF4bj7SeP5Mc2MSs=3QZXA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I've been working on a fairly large improvement to kcalc. Specifically a
much improved knumber library which will eventually bring arbitrary
precision trig functions :-).
Anyway, looking throughout the code, I see a LOT of usage of QLatin1String
and QLatin1Char and I'm not 100% sure what the benefit is.
From the documentation is looks as though it's primary usage is to be able
to specify string constants without needed to create a full QString object.
here's my question, if that constant is going to become a QString anyway,
is there any benefit? For example:
// does this make sense?
QString func() {
return QLatin1String("Hello world");
}
The documentation is even more vague about the benefits of QLatin1Char, it
says it used to avoid codec stuff, which I highly doubt is being used in
kcalc. So can I expect there to be any benefit?
Unfortunately while it is used in a lot of places, the usage isn't 100%
consistant, based on the fact that things seem to work, I'm not sure what
improvement it is offering.
What do you guys think?
Evan Teran
[Attachment #5 (text/html)]
I've been working on a fairly large improvement to kcalc. Specifically =
a much improved knumber library which will eventually bring arbitrary preci=
sion trig functions :-).<div><br></div><div>Anyway, looking throughout the =
code, I see a LOT of usage of QLatin1String and QLatin1Char and I'm not=
100% sure what the benefit is.</div>
<div><br></div><div>From the documentation is looks as though it's prim=
ary usage is to be able to specify string constants without needed to creat=
e a full QString object. here's my question, if that constant is going =
to become a QString anyway, is there any benefit? For example:</div>
<div><br></div><div>// does this make sense?</div><div>QString func() {</di=
v><div>=C2=A0 =C2=A0 return QLatin1String("Hello world");</div><d=
iv>}</div><div><br></div><div>The documentation is even more vague about th=
e benefits of QLatin1Char, it says it used to avoid codec stuff, which I hi=
ghly doubt is being used in kcalc. So can I expect there to be any benefit?=
</div>
<div><br></div><div>Unfortunately while it is used in a lot of places, the =
usage isn't 100% consistant, based on the fact that things seem to work=
, I'm not sure what improvement it is offering.</div><div><br></div>
<div>What do you guys think?</div><div><br></div><div>Evan Teran</div>
_______________________________________________
Kde-utils-devel mailing list
Kde-utils-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-utils-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic