All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Han-Wen Nienhuys <hanwen@google.com>
Cc: "René Scharfe" <l.s.r@web.de>, "Git List" <git@vger.kernel.org>
Subject: Re: [PATCH] refs/files-backend: remove unused open mode parameter
Date: Mon, 13 Sep 2021 11:22:49 -0700	[thread overview]
Message-ID: <xmqqilz4fi86.fsf@gitster.g> (raw)
In-Reply-To: <CAFQ2z_NAXsOzbWujpm=jGxODJi+xsC9iFYd-W+dTqn9j5DybjQ@mail.gmail.com> (Han-Wen Nienhuys's message of "Mon, 13 Sep 2021 12:12:03 +0200")

Han-Wen Nienhuys <hanwen@google.com> writes:

> On Thu, Sep 9, 2021 at 11:46 PM René Scharfe <l.s.r@web.de> wrote:
>>
>> We only need to provide a mode if we are willing to let open(2) create
>> the file, which is not the case here, so drop the unnecessary parameter.
>
> I was #today years old when I learned that C supports (a limited form
> of) function signature overloading.

I do not think it is that kind of magic.

Like printf(3) that allows its early parameter to affect the way how
its later parameters are recognised, it just allows the flags word
to decide if it needs to grab one extra mode_t out of va_list or
not, which can be done as a plain vanilla varargs function, i.e.

	extern int open(const char *path, int flags, ...);


  reply	other threads:[~2021-09-13 18:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 21:45 [PATCH] refs/files-backend: remove unused open mode parameter René Scharfe
2021-09-10  0:45 ` Junio C Hamano
2021-09-13 10:12 ` Han-Wen Nienhuys
2021-09-13 18:22   ` Junio C Hamano [this message]
2021-09-13 19:03     ` Jeff King

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=xmqqilz4fi86.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=hanwen@google.com \
    --cc=l.s.r@web.de \
    /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.