Re: [PATCH 3/8] Add yaffs2 file system: guts code

From: Jesper Juhl
Date: Mon Dec 06 2010 - 17:23:31 EST


On Tue, 7 Dec 2010, Charles Manning wrote:

> On Tuesday 07 December 2010 01:55:43 Arnd Bergmann wrote:
> > On Monday 06 December 2010, Charles Manning wrote:
> > > On Wednesday 01 December 2010 11:23:53 you wrote:
> > > > On Tuesday 30 November 2010 22:57:29 Charles Manning wrote:
> > > > It would be better to reorder the functions in each file so that
> > > > you don't need forward declarations. This generally makes reading
> > > > the code easier because it is what people expect to see. It
> > > > also makes it clearer where you have possible recursions in the code.
> > >
> > > Hmmm..
> > > I too prefer minimal use of forward declaration.
> > > Some of them are because I copied the layout of existing kernel code
> > > which uses fwd declarations a lot. eg. fs/jffs2/dir.c and many of the
> > > examples in Rubini & Corbet.
> >
> > There is not much point in changing the legacy code that's already in
> > the kernel, but let's try to keep it clean for new code. We have a lot
> > of bad examples for coding style that we wouldn't merge these days.
> >
> > In this case, it should be an obvious change with no real downsides.
>
> Arnd thanks for your input, I appreciate it immensely.
>
> Is this objection to forward declarations just your personal taste or is this
> a real issue?
>

I can only speak for myself here (which obviously makes this comment a
"personal taste thing). I personally hate all those forward declarations
and whenever I'm modifying kernel code I try to see if I can move stuff
around to get rid of some.
We have to live with what's already in the tree, but there's no reason to
add more gunk. It's easy to just re-order functions to get rid of the
forward declarations, so why not just do that - makes it so much nicer to
read (now and in the future - by thousands of people).


> I can't find any references to forward declarations in any of the coding style
> docs. I would therefore expect it to be an issue of little consequence.
> Perhaps I did not look in the right places.
>

I don't think it's written in stone anywhere, it's just one of those
thiings where one alternative is obviously so much nicer than the other...


> It is perhaps also worth considering that yaffs has been in use for 8 years
> and is more widely used than many of the file systems already in the kernel
> and thus, by some measures, does constitute legacy code.
>

In terms of mainline Linux kernel inclusion it does not.


--
Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.

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