[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-ddrescue] [PATCH 2/7] treewide: Replace size() with empty() whe
Antonio Diaz Diaz
Re: [Bug-ddrescue] [PATCH 2/7] treewide: Replace size() with empty() where appropriate
Wed, 16 Oct 2019 22:10:51 +0200
Mozilla/5.0 (X11; U; Linux i586; en-US; rv:18.104.22.168) Gecko/20110420 SeaMonkey/2.0.14
Rosen Penev wrote:
For vectors and strings (what ddrescue uses) empty() is defined as 'size()
== 0'. So nothing is gained with this change.
I agree it's the same. Whether it's cleaner or not is subjective.
I generally find cleaner to avoid negations:
if( foo.size() && bar.size() )
if( !foo.empty() && !bar.empty() )
I can resubmit if you would like. My guess is no.
You guess well. :-) I never apply patches like this one. I directly modify
the parts of the code that I think the patch improves, and ignore the rest.
[Bug-ddrescue] [PATCH 3/7] [clang-tidy] Remove const from superfluous locations, Rosen Penev, 2019/10/14
Re: [Bug-ddrescue] [PATCH 1/7] tree: Remove stdint.h from two unnecessary places, Antonio Diaz Diaz, 2019/10/15