From: David Kastrup <dak@gnu.org>
To: Jeff King <peff@peff.net>
Cc: John Keeping <john@keeping.me.uk>, git@vger.kernel.org
Subject: Re: [PATCH 1/5] notes-utils: handle boolean notes.rewritemode correctly
Date: Tue, 18 Feb 2014 10:36:07 +0100 [thread overview]
Message-ID: <87mwhosqyg.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <20140218090156.GC2692@sigill.intra.peff.net> (Jeff King's message of "Tue, 18 Feb 2014 04:01:56 -0500")
Jeff King <peff@peff.net> writes:
> 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");
if (something_failed)
return error("this will get printed"), -1;
Not much of an idiom, no insider logic hidden to both compiler and
reader.
>>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.
Assuming that.
>> 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.
I consider insider semantics ugly and annoying. To each his own.
> 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.
It's further raising the barriers for contributors if they are expected
to have studied the last few years in the mailing archive. And the
skills needed for that kind of study are mostly unrelated to good
programming skills.
So I am less than convinced that this is among the coding practices that
can be expected to attract/scare away potential contributors in
proportion to their expected capability of advancing/hindering the
project.
It's not me running the shop, so it's nothing more than an opinion.
--
David Kastrup
next prev parent reply other threads:[~2014-02-18 9:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-16 16:06 [PATCH 0/5] Miscellaneous fixes from static analysis John Keeping
2014-02-16 16:06 ` [PATCH 1/5] notes-utils: handle boolean notes.rewritemode correctly John Keeping
2014-02-16 16:22 ` David Kastrup
2014-02-18 7:46 ` Jeff King
2014-02-18 8:41 ` David Kastrup
2014-02-18 9:01 ` Jeff King
2014-02-18 9:36 ` David Kastrup [this message]
2014-02-16 16:06 ` [PATCH 2/5] utf8: fix iconv error detection John Keeping
2014-02-16 16:06 ` [PATCH 3/5] utf8: use correct type for values in interval table John Keeping
2014-02-16 16:06 ` [PATCH 4/5] builtin/mv: don't use memory after free John Keeping
2014-02-16 16:06 ` [PATCH 5/5] streaming: simplify attaching a filter John Keeping
2014-02-18 23:56 ` Junio C Hamano
2014-02-19 0:02 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mwhosqyg.fsf@fencepost.gnu.org \
--to=dak@gnu.org \
--cc=git@vger.kernel.org \
--cc=john@keeping.me.uk \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.