Re: Throw some low-level C scutwork at me - Mailing list pgsql-hackers

From David Fetter
Subject Re: Throw some low-level C scutwork at me
Date
Msg-id 20090501175456.GC14851@fetter.org
Whole thread Raw
In response to Re: Throw some low-level C scutwork at me  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Throw some low-level C scutwork at me  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
On Fri, May 01, 2009 at 01:38:38PM -0400, Andrew Dunstan wrote:
> David E. Wheeler wrote:
>> On May 1, 2009, at 8:38 AM, Robert Haas wrote:
>>
>>> Speaking of space/tab settings, one thing I'm fuzzy on is the rule
>>> for wrapping long lines.  I understand that a line that extends
>>> past 80 characters has to be wrapped, but the amount of
>>> indentation on the continuation line doesn't appear to follow a
>>> consistent pattern - or does it?
>>
>> “Perl Best Practices” recommends an indentation of 4 spaces, both
>> for  block indentations and line continuations. Not sure what'd be
>> best for  C, though.
>
> Please, let's not have a whole host of different indentation styles.
> Postgres has a well established style.  Let's stick to it in both
> perl and C.

Perl is not C, and there's no good reason to make them look the same.
We don't format SQL the same way we do C either, and that's a totally
reasonable decision.

Using idiomatic perl like this:

foreach my $element (@array) {   # clear, short, idiomatic code here
}

instead of Rube Goldberg constructs like this:

my $i;
for ($i=0; $i <= $#array; ++$i)
{   # kludges up down and sideways here
}

is a good idea because it makes it easier for Perl programmers to
maintain.  It's also more efficient on the machine, for what that's
worth.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: Throw some low-level C scutwork at me
Next
From: "David E. Wheeler"
Date:
Subject: Re: Throw some low-level C scutwork at me