* [9fans] Coding layout query
@ 2002-03-07 22:49 Andrew Simmons
2002-03-08 9:59 ` Thomas Bushnell, BSG
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Andrew Simmons @ 2002-03-07 22:49 UTC (permalink / raw)
To: 9fans
Not wishing to start a religious debate here, but I notice that in the
Plan9 source code, the return type of a function is placed on a separate
line from the function name when the function is defined:
int
nurdge(int a)
or even
static
int
nurdge(int a)
whereas in the header file, the return type is on the same line:
int nurdge(int)
It's not a style I've seen before, even, if memory serves, in TPOP, and I
was wondering if it was purely a matter of taste, or whether there was some
perceived benefit to be gained from laying the code out in this way - I
find it rather disconcerting at present.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] Coding layout query
2002-03-07 22:49 [9fans] Coding layout query Andrew Simmons
@ 2002-03-08 9:59 ` Thomas Bushnell, BSG
2002-03-08 9:59 ` ozan s. yigit
2002-03-08 16:18 ` Boyd Roberts
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Bushnell, BSG @ 2002-03-08 9:59 UTC (permalink / raw)
To: 9fans
andrew@mbmnz.co.nz (Andrew Simmons) writes:
> Not wishing to start a religious debate here, but I notice that in the
> Plan9 source code, the return type of a function is placed on a separate
> line from the function name when the function is defined:
>
> int
> nurdge(int a)
The normal reason for this is that various automatic program scanners
will detect this formatting and know that "nurdge" is a function
definition.
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] Coding layout query
2002-03-07 22:49 [9fans] Coding layout query Andrew Simmons
2002-03-08 9:59 ` Thomas Bushnell, BSG
@ 2002-03-08 9:59 ` ozan s. yigit
2002-03-08 16:18 ` Boyd Roberts
2 siblings, 0 replies; 6+ messages in thread
From: ozan s. yigit @ 2002-03-08 9:59 UTC (permalink / raw)
To: 9fans
andrew@mbmnz.co.nz (Andrew Simmons):
> Not wishing to start a religious debate here, but I notice that in the
> Plan9 source code, the return type of a function is placed on a separate
> line from the function name when the function is defined:
>
> int
> nurdge(int a)
[.. etc]
this is a fairly common style on many development groups i've been in.
[checking tilbrook code... yep] many O/S projects use that style as well.
eg. nmh, glib, gtk, gcc etc. it is the layout for gnu coding standard.
[www.gnu.org/prep/standards_23.html#SEC23].
oz
---
xyzzy! nothing happens.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] Coding layout query
2002-03-07 22:49 [9fans] Coding layout query Andrew Simmons
2002-03-08 9:59 ` Thomas Bushnell, BSG
2002-03-08 9:59 ` ozan s. yigit
@ 2002-03-08 16:18 ` Boyd Roberts
2 siblings, 0 replies; 6+ messages in thread
From: Boyd Roberts @ 2002-03-08 16:18 UTC (permalink / raw)
To: 9fans
Andrew Simmons wrote:
> int
> nurdge(int a)
> ...
>
> whereas in the header file, the return type is on the same line:
>
> int nurdge(int)
>
The contexts are different. I think both styles improve readability.
However, prototypes should never have been invented.
brucee's cyntax et al were much better ideas.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] Coding layout query
@ 2002-03-08 13:18 presotto
0 siblings, 0 replies; 6+ messages in thread
From: presotto @ 2002-03-08 13:18 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 67 bytes --]
In my case, it makes the non-automatic scanner 'grep ^fn *.c' work.
[-- Attachment #2: Type: message/rfc822, Size: 2005 bytes --]
From: "Thomas Bushnell, BSG" <tb+usenet@becket.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Coding layout query
Date: Fri, 8 Mar 2002 09:59:46 GMT
Message-ID: <87r8mwc6bf.fsf@becket.becket.net>
andrew@mbmnz.co.nz (Andrew Simmons) writes:
> Not wishing to start a religious debate here, but I notice that in the
> Plan9 source code, the return type of a function is placed on a separate
> line from the function name when the function is defined:
>
> int
> nurdge(int a)
The normal reason for this is that various automatic program scanners
will detect this formatting and know that "nurdge" is a function
definition.
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] Coding layout query
@ 2002-03-07 22:54 bwc
0 siblings, 0 replies; 6+ messages in thread
From: bwc @ 2002-03-07 22:54 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 48 bytes --]
/^nurdge/ -- to find the function in the code
[-- Attachment #2: Type: message/rfc822, Size: 2090 bytes --]
From: Andrew Simmons <andrew@mbmnz.co.nz>
To: 9fans@cse.psu.edu
Subject: [9fans] Coding layout query
Date: Fri, 08 Mar 2002 11:49:29 +1300
Message-ID: <3.0.6.32.20020308114929.009a27f0@pop3.clear.net.nz>
Not wishing to start a religious debate here, but I notice that in the
Plan9 source code, the return type of a function is placed on a separate
line from the function name when the function is defined:
int
nurdge(int a)
or even
static
int
nurdge(int a)
whereas in the header file, the return type is on the same line:
int nurdge(int)
It's not a style I've seen before, even, if memory serves, in TPOP, and I
was wondering if it was purely a matter of taste, or whether there was some
perceived benefit to be gained from laying the code out in this way - I
find it rather disconcerting at present.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-03-08 16:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-07 22:49 [9fans] Coding layout query Andrew Simmons
2002-03-08 9:59 ` Thomas Bushnell, BSG
2002-03-08 9:59 ` ozan s. yigit
2002-03-08 16:18 ` Boyd Roberts
2002-03-07 22:54 bwc
2002-03-08 13:18 presotto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).