Re: [PATCH] 2.5 Documentation/CodingStyle ANSI C function declarations.

From: Steven Cole (elenstev@mesatop.com)
Date: Mon Jun 02 2003 - 12:55:47 EST


On Mon, 2003-06-02 at 11:34, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jun 02, 2003 at 10:39:41AM -0600, Steven Cole escreveu:
> > On Mon, 2003-06-02 at 09:59, Linus Torvalds wrote:
> > > On 2 Jun 2003, Juan Quintela wrote:
> > > >
> > > > /**
> > > > * foo - <put something there>
> > > > * @bar: number of frobnicators
> > > > * @baz: self-larting on or off
> > > > * @userdata: pointer to arbitrary userdata to be registered
> > > > *
> > > > * Description: Please, fix me
> > > > */
> > > > int foo(long bar, long baz)
> > > > {
> > > > ...
> > > >
> > > > Looks like a better alternative to me.
> > >
> > > Hey, if somebody were to send me a patch (hint hint), I'd happily apply
> > > it.
> > >
> > > Linus
> >
> > I sent this last night as an example, except now the function
> > declaration is not wrapped. How is this?
> >
> > Steven
> >
> > --- linux/lib/zlib_inflate/inftrees.c.orig Mon Jun 2 10:15:29 2003
> > +++ linux/lib/zlib_inflate/inftrees.c Mon Jun 2 10:16:47 2003
> > @@ -288,14 +288,16 @@
> > return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
> > +int zlib_inflate_trees_bits(uIntf *c, uIntf *bb, inflate_huft * FAR *tb, inflate_huft *hp, z_streamp z)
> > {
> > int r;
> > uInt hn = 0; /* hufts used in space */
>
> I do it like this:
>
>
> int zlib_inflate_trees_bits(uIntf *c, uIntf *bb, inflate_huft * FAR *tb,
> inflate_huft *hp, z_streamp z)
>
> - Arnaldo

For zlib, here is a worst case, with three choices, and there may be
others since style is quite a matter of taste.

local int huft_build(uIntf *b, uInt n, uInt s, const uIntf *d, const uIntf *e,
                     inflate_huft * FAR *t, uIntf *m, inflate_huft *hp, uInt *hn, uIntf *v)

local int huft_build(uIntf *b, uInt n, uInt s, const uIntf *d, const uIntf *e,
        inflate_huft * FAR *t, uIntf *m, inflate_huft *hp, uInt *hn, uIntf *v)

local int huft_build(uIntf *b, uInt n, uInt s, const uIntf *d, const uIntf *e, inflate_huft * FAR *t, uIntf *m, inflate_huft *hp, uInt *hn, uIntf *v)

Steven

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 07 2003 - 22:00:17 EST