On Sat, Nov 17, 2007 at 10:43:25AM +0100, Paul Cochrane wrote:
> > > One nit I have about C-code is that I think there should be a space
> > > after commas and semicolons.
> >
> > I am not a C-coder, so I don't have an authoritative opinion about this.
> > But I would like to ask: In this a common standard/'best practice' in
> > C programming?
> >
> > If so, then I think the standard should be approved. But if it's not
> > yet generally accepted, I would say no.
>
> That's why I posted a patch to the list, so that this could be
> discussed. My opinion is that code is easier to read if there are
> spaces after commas, and spaces after semicolons (especially in for
> loops).
PDD 07 already speaks to requirement of spaces after commas
(pdd07_codingstd.pod:174):
Binary operators (except C<.> and C<< -> >>) should have at
least one space on either side; there should be no space between
unary operators and their operands; parentheses should not have
space immediately after the opening parenthesis nor immediately
before the closing parenthesis; commas should have at least one
space after, but not before; e.g.:
x = (a-- + b) * f(c, d / e.f)
So, I think a coding standard test for requiring spaces after
commas is okay.
There's not anything in pdd07 that talks about requiring spaces
after semicolons, so I think we should either add this requirement
to pdd07 or not test for it.
As an interesting counterpoint, we recently discussed and decided
on IRC that keys in PIR would _not_ have spaces around the semicolons --
i.e., ["Foo";"Bar"] instead of [ "Foo"; "Bar" ].
Pm