From: Phil Carmody <ext-phil.2.carmody@nokia.com>
To: ext Peter Seebach <peter.seebach@windriver.com>
Cc: "ext H. Peter Anvin" <hpa@zytor.com>, Jiri Slaby <jslaby@suse.cz>,
apw@canonical.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] checkpatch.pl: thou shalt not use () or (...) in function declarations
Date: Thu, 22 Mar 2012 22:01:44 +0200 [thread overview]
Message-ID: <20120322200144.GF19970@pcarmody2.research.nokia.com> (raw)
In-Reply-To: <20120322141005.1abe7b1e@wrlaptop>
On 22/03/12 14:10 -0500, ext Peter Seebach wrote:
> On Thu, 22 Mar 2012 19:48:02 +0200
> Phil Carmody <ext-phil.2.carmody@nokia.com> wrote:
>
> > While empty paramter lists in function definitions are not technically
> > wrong, those situations are rare enough that it's worth encouraging
> > people towards a more uniform, always unambiguous, style.
>
> Typo here ("paramter").
>
> You don't need to check for (...). That doesn't actually exist, and
> gcc rejects it (as it should). The description of () as meaning (...)
> is a (slight) oversimplification.
Thanks, and thanks, yup. I just got carried away by HPA's wonderful tale,
I took it too literally.
> As to the () case:
>
> The rules here are complicated. Complicated enough that I don't even
> TRY to remember them. Fundamentally, f() is equivalent to either
> f(void) or f(please do unpleasant things to me with railroad spikes).
> I would definitely endorse a policy discouraging its use.
It appears we have quite broad agreement, it's just the details that
need to be polished.
> I can only think of one exception, and it's inapplicable. The
> exception: Imagine that you wish to write a wrapper for a function
> like scandir, which takes a function pointer as an argument, and you
> wish the wrapper to work on two systems where the arguments passed to
> the function pointer are of different types, but you yourself will
> never actually see or care about the arguments; you just want to pass
> the function pointer around. Then it could make sense to declare the
> argument as int (*compar)(). But that's a once-a-lifetime use case,
> give or take.
Maybe WG14 should introduce (...) for just that case! :-D
Cheers for your input Seebs,
Phil
next prev parent reply other threads:[~2012-03-22 20:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 15:27 Phil Carmody
2012-03-22 15:49 ` richard -rw- weinberger
2012-03-22 16:33 ` Joe Perches
2012-03-22 16:22 ` Jiri Slaby
2012-03-22 16:49 ` Valdis.Kletnieks
2012-03-22 16:55 ` Jiri Slaby
2012-03-22 17:00 ` Jiri Slaby
2012-03-22 17:17 ` Valdis.Kletnieks
2012-03-22 19:00 ` Joe Perches
2012-03-22 16:53 ` H. Peter Anvin
2012-03-22 16:56 ` Jiri Slaby
2012-03-22 17:48 ` Phil Carmody
2012-03-22 19:10 ` Peter Seebach
2012-03-22 20:01 ` Phil Carmody [this message]
2012-03-22 17:17 ` Nick Bowler
2012-03-22 17:19 ` Nick Bowler
2012-03-26 10:03 ` Pedro Alves
2012-04-16 6:11 ` H. Peter Anvin
2012-03-22 17:32 ` Phil Carmody
2012-04-15 18:18 ` Phil Carmody
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=20120322200144.GF19970@pcarmody2.research.nokia.com \
--to=ext-phil.2.carmody@nokia.com \
--cc=apw@canonical.com \
--cc=hpa@zytor.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.seebach@windriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome