Re: [RFC PATCH 1/5] builtin/checkout: avoid usage of '!!'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 20, 2017, 04:00 UTC
- Message-ID
- <xmqq8thaow8f.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170919071525.9404-2-kaarticsivaraam91196@gmail.com>
Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:
> There was a usage for which there's no compelling reason.So, replace > such a usage as with something else that expresses the intent more > clearly.
I actually think this is a good example of the exception-rule. The function wants to take true or false in "int", and the caller has a pointer. And !!ptr is a shorter and more established way than ptr != NULL to turn non-NULL ness into an int boolean, without having to either repeat or introducing an otherwise unnecessary temporary.