practicalswift
commented at 9:38 PM on July 2, 2017:
contributor
Changes:
Prefer x.empty() over x.size() == 0 and x.length() == 0
Prefer !x.empty() over bool(x.size())
Prefer !x.empty() over x.size() > 0
Rationale:
Improve readability.
Avoid nongeneric code - see "T.143: Don't write unintentionally nongeneric code" in the C++ Core Guidelines (Stroustrup & Sutter): "Emptiness works for more containers than size(), because some containers don't know their size or are conceptually of unbounded size."
practicalswift renamed this: scripted-diff: Prefer x.empty() over x.size() == 0 or x.length() == 0 scripted-diff: Prefer x.empty() over x.size() == 0 and x.length() == 0 on Jul 2, 2017
fanquake added the label Refactoring on Jul 3, 2017
promag
commented at 8:37 AM on July 3, 2017:
member
Should these
if (container.size()) { ... }
if (container.size() > 0) { ... }
be
if (!container.empty()) { ... }
?
practicalswift force-pushed on Jul 3, 2017
practicalswift force-pushed on Jul 3, 2017
practicalswift
commented at 2:42 PM on July 3, 2017:
contributor
practicalswift
commented at 8:59 AM on July 4, 2017:
contributor
@promag Two reasons - when thinking about it I had my doubts if this PR is worth doing (the changes might be a bit too picky and the number of changes make it a bit heavy to review) and also that the PR failed to gain any concept ACKs from core developers :-) But thanks for reviewing anyways!
promag
commented at 9:03 AM on July 4, 2017:
member
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-04-16 15:15 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me