Re: [PATCH 1/2] inline constant return from error() function
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 11, 2014, 17:22 UTC
- Message-ID
- <xmqqppjkut6s.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20140507030254.GC20726@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> On Tue, May 06, 2014 at 03:29:37PM -0700, Junio C Hamano wrote: > >> That's kind of W*A*T magic, and I generally try to avoid magic, as >> long as it solves your "can we make both -O2 with new compilers and >> -O3 happy?" I wouldn't complain ;-) > > I agree it's rather magical, but I think it's something we can count on.
Certainly. Sorry that I missed "but" before "as long as", which made me sound as if I were unhappy. At least, I didn't call it an ugly "hack" ;-)
The alternative you mentioned up-thread "... to write out "return error(...)" as "error(...); return -1". In some ways that is more readable, though it is more verbose..." has one more downside you did not mention, and the approach to encapsulate it inside error() will not have it: new call-sites to error() do not have to worry about the issue with this approach.
Until it breaks, that is. But that goes without saying with the "it's something we can count on" pre-condition in place ;-).