From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: "#define precompose_argv(c,v) /* empty */" is evil
Date: Fri, 7 Aug 2020 00:01:26 +0000 [thread overview]
Message-ID: <20200807000126.GC8085@camp.crustytoothpaste.net> (raw)
In-Reply-To: <xmqqy2mribft.fsf@gitster.c.googlers.com>
[-- Attachment #1: Type: text/plain, Size: 739 bytes --]
On 2020-08-06 at 23:47:34, Junio C Hamano wrote:
> I am wondering if it is a good idea to use something like
>
> static inline void precompose_argv(int argc, const char **argv)
> {
> ; /* nothing */
> }
>
> instead. As long as the compiler is reasonable enough, this should
> not result in any code change in the result, except that it would
> still catch wrong arguments, even if these two parameters are unused
> and optimized out.
Yes, this seems like a prudent approach. I believe it's widely used by
the Linux kernel, so presumably compilers are capable enough to optimize
it out. As you noted, it provides type checking for all platforms,
which is nice.
--
brian m. carlson: Houston, Texas, US
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
next prev parent reply other threads:[~2020-08-07 0:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-06 23:47 "#define precompose_argv(c,v) /* empty */" is evil Junio C Hamano
2020-08-07 0:01 ` brian m. carlson [this message]
2020-08-07 0:23 ` Junio C Hamano
2020-08-07 1:32 ` brian m. carlson
2020-08-07 4:03 ` Junio C Hamano
2020-08-07 3:27 ` Jeff King
2020-08-07 4:09 ` Junio C Hamano
2020-08-07 4:34 ` Jeff King
2020-08-07 6:42 ` Junio C Hamano
2020-08-07 7:56 ` Torsten Bögershausen
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=20200807000126.GC8085@camp.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.