[Qt-interest] QString::isEmpty vs. comparing against an empty string

Bruce Cran bruce at cran.org.uk
Mon Mar 1 20:08:25 CET 2010


Hi,

I was reading through the Address Book example at 
http://doc.qt.nokia.com/4.6/tutorials-addressbook-part2.html and the code that 
checks if the input is empty jumped out at me. Coming from a .NET background 
I'm all too familiar with the FxCop warning informing people to check if the 
string length is 0 instead of comparing against the empty string to improve 
performance.
I know it's only a minor optimization, but is using QString::isEmpty preferred 
in the Qt world?

-- 
Bruce Cran



More information about the Qt-interest-old mailing list