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

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



On 01/06/2015 01:43 AM, Kamil Dudka wrote:
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

Myself, if I saw some code that appeared pointless, I would sit there staring at it until I educated myself as to why it was there, because I wouldn't expect that pointless code would ever be tolerated.



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