Re: Throw some low-level C scutwork at me

From: David Fetter <david(at)fetter(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andy Lester <andy(at)petdance(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Throw some low-level C scutwork at me
Date: 2009-05-01 17:54:56
Message-ID: 20090501175456.GC14851@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2009-05-01 18:01:41 Re: Throw some low-level C scutwork at me
Previous Message David E. Wheeler 2009-05-01 17:39:47 Re: Throw some low-level C scutwork at me