Bug 392912

Summary: Proposal for check qstring-allocations
Product: [Developer tools] clazy Reporter: Roman <dismine>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: CONFIRMED ---    
Severity: wishlist CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Roman 2018-04-09 07:18:36 UTC
Hi,

I continue using clazy for my project. And found out, as i think, one particularly interesting case. Any string with single character for example "*" will trigger check qstring-allocations. But does advice to use QStringLiteral in this case is optimal? How about QChar or QLatin1Char? QStringLiteral gives binary blow up if repeated several times, plus working with single char is more efficient because no need to handle end of string (\0). Adding single characters to a QString is faster if the characters are QChars and not QStrings. Same holds for arguments to QString::startsWith(), QString::endsWith(), QString::remove() and QString::section(). Maybe it is even worth to match QStringLiteral("*") as unneeded complexity.

Sorry, if from your point of view i start a discussion here, i don't know another way to reach you except of irc that i don't use. The email field is empty on github.