Re: [RFC PATCH 1/5] builtin/checkout: avoid usage of '!!'
- From
Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
- Date
- Sep 23, 2017, 12:17 UTC
- Message-ID
- <de378f54-1c6f-327e-3f61-f8b215cfe203@gmail.com>
- In-Reply-To
- <xmqqlgl8n8fn.fsf@gitster.mtv.corp.google.com>
On Thursday 21 September 2017 07:01 AM, Junio C Hamano wrote:
Show 6 quoted lines
> What does "with arithmetic constructs" mean? Would it refer to > things like > > !!i != !!(j + 3) > > that unnecessarily obfuscates what is going on?
Thanks that clears the confusion because I haven't seen constructs like this before (who would even do something like this?)
Show 9 quoted lines
> The primary reason why !!ptr is good in the code that this patch > touches is because what is doubly negated is a pointer, not an > integer or other things. The called function does *not* limit its > input to 0 or 1 (it wants 0 for false and everything else for true), > so we wouldn't be doing !!i if what we are passing is already an > integer. But we cannot just pass a pointer to such a parameter > without getting the compiler upset. > >
Done. So I'll drop this patch.
--- Kaartic