Bug 392912 - Proposal for check qstring-allocations
Summary: Proposal for check qstring-allocations
Status: CONFIRMED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-09 07:18 UTC by Roman
Modified: 2018-08-15 18:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.