Skip to contentSkip to conversation

CodingStyle

DISCUSSION HarryWei 1 participant 1 message Dec 11, 2010 1 message not in the archive

lore
Share & tools
lore

HarryWei

author
#1 lore raw
In reply to a message not in the archive
Quoted 32 lines

2010/12/11 Robert P. J. Day <[email protected]>

Quoted 30 lines · HarryWei
Quoted 3 lines

Hi all,
I just read the CodingSyle at Documentation directory in

linux-2.6.23 kernel source code.

Quoted 2 lines

But a problem happened to me like following. Functions in linux-2.6.23/fs/fs-writeback.c are "static int" and

function name are in different lines.(function name in following line)

Quoted 1 line

I can't find the rule in CodingStyle. That We often program

functions are "static int" and function name are in the same line.

Quoted 1 line

When do we do the first or second way? What is different between

them?

Quoted 3 lines

Any answer is okay.
Best regards.

the advantage to the form

static int
function-name

is that, if you're looking for the actual function *definition* in the file, having the function name at the start of a new line means you can search for it with the pattern "^function-name" so that you don't have to wade through all of the invocations of that function.

i like that style; others claim that with proper cross-referencers
like cscope, doing that is redundant. as far as i know, the kernel coding style doesn't take a position on that, but i'm willing to be corrected.

Thanks, i see :)

Quoted 20 lines
Quoted 13 lines

rday

--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday

========================================================================

Signature · 3 lines
Best Regards.
Harry Wei.
Do what u like!