Bug 468419 - Add a check that discourages isNull (in favor of isEmpty)
Summary: Add a check that discourages isNull (in favor of isEmpty)
Status: REPORTED
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: 2023-04-12 11:22 UTC by Giuseppe D'Angelo
Modified: 2023-04-12 11:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giuseppe D'Angelo 2023-04-12 11:22:29 UTC
Qt string-like classes feature two similar but different functions: isNull and isEmpty. There are differences between the two, and the differences are subtle; a null string is always empty but an empty string isn't necessarily null (e.g. QString("") is empty but not null). Usage of isNull is almost always questionable.

(One could also extend this to other classes, e.g. QRect, where the null vs. empty semantics are very weird.)