mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Phil Carmody <ext-phil.2.carmody@nokia.com>
To: "ext H. Peter Anvin" <hpa@zytor.com>
Cc: 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 19:48:02 +0200	[thread overview]
Message-ID: <20120322174802.GE19970@pcarmody2.research.nokia.com> (raw)
In-Reply-To: <4F6B5902.1080607@zytor.com>

On 22/03/12 09:53 -0700, ext H. Peter Anvin wrote:
> On 03/22/2012 09:22 AM, Jiri Slaby wrote:
> > 
> > That explanation is not fully correct. C99 explicitly says (6.7.5.3.14):
> > An identifier list declares only the identifiers of the parameters of
> > the function. An empty list in a function declarator that is part of a
> > definition of that function specifies that the function has no
> > parameters. The empty list in a function declarator that is not part of
> > a definition of that function specifies that no information about the
> > number or types of the parameters is supplied.
> > 
> > So what you are trying to force here holds only for (forward)
> > declarations. Not for functions with definitions (bodies). Is checkpatch
> > capable to differ between those?
> 
> We shouldn't use it anyway.  gcc might take it that way in C99 mode, but
> it's unclear if it does it in the default mode, and having declarators
> and definitions be different is just asking for trouble.

This perhaps? (And my support goes to any better rewordings.)


From: Phil Carmody <ext-phil.2.carmody@nokia.com>
Date: Thu, 22 Mar 2012 19:40:47 +0200
Subject: [PATCH 2/2] Documentation/CodingStyle: outlaw () use (void)

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.
http://lkml.org/lkml/2012/3/22/241

Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
---
 Documentation/CodingStyle |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 2b90d32..c4b9df7 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -381,6 +381,8 @@ EXPORT_SYMBOL(system_is_up);
 In function prototypes, include parameter names with their data types.
 Although this is not required by the C language, it is preferred in Linux
 because it is a simple way to add valuable information for the reader.
+Do not use empty parameter lists, as they sometimes mean one thing and
+sometimes mean another - avoid ambiguity by using (void).
 
 
 		Chapter 7: Centralized exiting of functions
-- 
1.7.2.5

  parent reply	other threads:[~2012-03-22 17:52 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 [this message]
2012-03-22 19:10       ` Peter Seebach
2012-03-22 20:01         ` Phil Carmody
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=20120322174802.GE19970@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 \
    /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

all inboxes | Powered by JetHome®