Re: Question about style when converting from K&R to ANSI C.

Erik Hensema (erik@hensema.net)
Mon, 2 Jun 2003 15:54:21 +0000 (UTC)


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/