public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Pollard <jesse@cats-chateau.net>
To: Larry McVoy <lm@bitmover.com>, Willy Tarreau <willy@w.ods.org>
Cc: Larry McVoy <lm@bitmover.com>, Steven Cole <elenstev@mesatop.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Question about style when converting from K&R to ANSI C.
Date: Mon, 2 Jun 2003 07:39:12 -0500	[thread overview]
Message-ID: <03060207391200.24067@tabby> (raw)
In-Reply-To: <20030601140602.GA3641@work.bitmover.com>

On Sunday 01 June 2003 09:06, Larry McVoy wrote:
> > > Sometimes it is nice to be able to see function names with a
> > >
> > > 	grep '^[a-zA-Z].*(' *.c
> >
> > This will return 'int foo(void)', what's the problem ?
>
> You get a lot of other false hits, like globals.  I don't feel strongly
> about this, I'm more wondering why this style was choosen.  The way
> I showed is pretty common,  it's sort of the "Unix" way (it's how the
> original Unix guys did it, how BSD did it, and how the GNU guys do it), so
> it's a somewhat surprising difference.  I've never understood the logic.
> The more I think about it the less I understand it, doing it that way
> means you are more likely to have to wrap a function definition which
> is ugly:
>
> static inline int cdrom_write_check_ireason(ide_drive_t *drive, int len,
> int ireason) {
> }

Actually, that would most likely be:
static inline int cdrom_write_check_ireason(
			ide_drive_t *drive,
			int len,
			int ireason
)
{
...
}

At least If I were doing it. Over my 20 years, I've found that many of MY
type errors are due to returning or expecting the wrong structure/variable
because I forgot the type of the function.

I rarely have to look at the parameters (though when I do, I locate them
via the function name, then scan the parameters...) sometimes just to count
the number of parameters, or the order, which is easier when the parameters
are one to a line. Either as in K&R, or the new style.


  parent reply	other threads:[~2003-06-02 12:26 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-01  5:56 Question about style when converting from K&R to ANSI C Steven Cole
2003-06-01  6:39 ` Arnaldo Carvalho de Melo
2003-06-01  6:43   ` Zwane Mwaikambo
2003-06-01 13:14     ` Alan Cox
2003-06-01 19:10       ` Zwane Mwaikambo
2003-06-01 13:26 ` Larry McVoy
2003-06-01 13:49   ` Willy Tarreau
2003-06-01 14:06     ` Larry McVoy
2003-06-01 14:22       ` Willy Tarreau
2003-06-01 15:02       ` Steven Cole
2003-06-01 15:09         ` Larry McVoy
2003-06-01 15:50           ` Steven Cole
2003-06-01 16:02             ` Larry McVoy
2003-06-01 16:18               ` Steven Cole
2003-06-01 23:01         ` Paul Mackerras
2003-06-01 23:30           ` Steven Cole
2003-06-03  3:29         ` Robert White
2003-06-01 16:04       ` Jonathan Lundell
2003-06-01 16:11         ` Larry McVoy
2003-06-01 16:46           ` Steven Cole
2003-06-01 16:52             ` Larry McVoy
2003-06-01 17:18               ` Steven Cole
2003-06-02 12:39       ` Jesse Pollard [this message]
2003-06-03  3:15       ` Robert White
2003-06-01 13:53   ` Scott Robert Ladd
2003-06-02  2:09   ` Linus Torvalds
2003-06-02  2:21     ` Larry McVoy
2003-06-02  2:26       ` Davide Libenzi
2003-06-02  3:15     ` Steven Cole
2003-06-02 15:54     ` Erik Hensema
2003-06-03 12:32     ` Martin Waitz
2003-06-03 12:45       ` Dave Jones
2003-06-03 12:51         ` Jörn Engel
2003-06-03 13:18         ` Henning P. Schmiedehausen
2003-06-03 13:27           ` Richard B. Johnson
2003-06-03 13:39           ` William Lee Irwin III
2003-06-03 14:44             ` Henning Schmiedehausen
2003-06-03 15:16               ` William Lee Irwin III
2003-06-03 15:25               ` Randy.Dunlap
2003-06-03 15:38                 ` William Lee Irwin III
2003-06-03 15:40                   ` Randy.Dunlap
     [not found] <20030601060013$0d74@gated-at.bofh.it>
     [not found] ` <20030601134006$4765@gated-at.bofh.it>
     [not found]   ` <20030602022006$78ca@gated-at.bofh.it>
     [not found]     ` <20030602160025$70e8@gated-at.bofh.it>
2003-06-02 16:09       ` Pascal Schmidt

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=03060207391200.24067@tabby \
    --to=jesse@cats-chateau.net \
    --cc=elenstev@mesatop.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm@bitmover.com \
    --cc=willy@w.ods.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