Re: [PATCH 1/5] notes-utils: handle boolean notes.rewritemode correctly
- From
Jeff King <peff@peff.net>
- Date
- Feb 18, 2014, 09:01 UTC
- Message-ID
- <20140218090156.GC2692@sigill.intra.peff.net>
- In-Reply-To
- <87vbwcstgw.fsf@fencepost.gnu.org>
On Tue, Feb 18, 2014 at 09:41:51AM +0100, David Kastrup wrote:
> gcc's flow analysis works with the same data as humans reading the > code. If there is no information content in the function call, it makes > more sense to either making it void.
The point of error() returning a constant -1 is to use this idiom:
if (something_failed)
return error("this will get printed, and we get a -1 return");>From a code perspective it's pointless. You could "just" write:
if (something_failed) {
error(...);
return -1;
}which is equivalent. But the point is that the former is shorter and a little more readable, assuming you are familiar with the idiom.
> One can always explicitly write
>
> (config_error_nonbool("panic-when-assailed"), -1)Yes, but again, the point is readability. Doing that at each callsite is ugly and annoying.
> Shrug. This one has likely been discussed to death already. Sometimes > it's more convenient to avoid getting a question asked in the first > place rather than having a stock answer for it.
You are the first person to ask about it, so there is no stock answer. However, everything I told you was in the commit messages and the list archive already. We can also avoid questions being asked by using those tools.
-Peff