bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ddrescue] [PATCH 2/7] treewide: Replace size() with empty() whe


From: Antonio Diaz Diaz
Subject: Re: [Bug-ddrescue] [PATCH 2/7] treewide: Replace size() with empty() where appropriate
Date: Wed, 16 Oct 2019 22:10:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) 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.


Best regards,
Antonio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]