lkml.org 
[lkml]   [2003]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Question about style when converting from K&R to ANSI C.
Date
Linus Torvalds (torvalds@transmeta.com) wrote:
> In article <20030601132626.GA3012@work.bitmover.com>,
> Larry McVoy <lm@bitmover.com> wrote:
>>On Sat, May 31, 2003 at 11:56:16PM -0600, Steven Cole wrote:
>>> Proposed conversion:
>>>
>>> int foo(void)
>>> {
>>> /* body here */
>>> }
>>
>>Sometimes it is nice to be able to see function names with a
>>
>> grep '^[a-zA-Z].*(' *.c
>>
>>which is why I've always preferred
>>
>>int
>>foo(void)
>>{
>> /* body here */
>>}
>
> That makes no sense.

But it does. Type /^foo <enter> and you're at the function definition. At
least when using vi, which is the editor everybody's using, right? ;-)

Also, when in working in a (too) long function body, type ?^{ and you're
at the start of the function body.

> Do you write your normal variable definitions like
>
> int
> a,b,c;
>
> too? No you don't, because that would be totally idiotic.

Indeed, searching for ^a will fail. There's no reason whatsoever why you'd
declare your variables that way.

--
Erik Hensema <erik@hensema.net>
-
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/

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