Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH 06/17: compctl: Remove pointless check



On Monday 05 January 2015 23:53:02 Bart Schaefer wrote:
> On Jan 6,  6:25am, Mikael Magnusson wrote:
> } Subject: PATCH 06/17: compctl: Remove pointless check
> }
> } cc has already been derefed a bunch of times leading up to here. Found
> } by Coverity (Issue 1255841).
> } -    if (cc && cc->xor) {
> } +    if (cc->xor) {
> 
> I'm curious, why bother to "fix" this (and a couple of similar others in
> later patches in this series)?  It's not *wrong*, and the change is not
> a significant optimization.

True, modern compilers would optimize out such checks anyway in some cases.  
Nevertheless, I believe that putting it explicit makes the code easier to 
understand for a human reader.

Kamil



Messages sorted by: Reverse Date, Date, Thread, Author