[lkml]   [2003]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Question about style when converting from K&R to ANSI C.
> > 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)


static inline int
cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)

It may be just what you are used to but I also find that when reading lots
of code it is nice to have it look like

return type

because the function_name() stands out more, it's always at the left side so
I tend to parse it a little more quickly.

Don't get me wrong, I'm not arguing that you should go reformat all your
code (I tend to agree with Linus, if it's not your code, don't stick your
fingers in there just because you want to reformat it). All I'm doing
is trying to understand why in this instance did Linux diverage from
common practice.
Larry McVoy lm at
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:35    [W:0.184 / U:5.584 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site