Mailing List Archive

Recent changes in ripd.c (coding style)
Hello,

I have just noticed that someone has just changed all tabs into spaces in
the rip_rte_process() function. Was this intentional? It is hard to check
what was realy changed because of this tabs to spaces conversion. Anyway,
what is preffered coding style for quagga?

Best Regards,

Krzysztof Olêdzki
Re: Recent changes in ripd.c (coding style) [ In reply to ]
On Tue, 11 May 2004, Krzysztof Oledzki wrote:

> Hello,
>
> I have just noticed that someone has just changed all tabs into
> spaces in the rip_rte_process() function. Was this intentional?

Sort of yes.

> It is hard to check what was realy changed because of this tabs to
> spaces conversion.

Yes. Essentially only one line changed. The whitespace change should
have been changed in a seperate commit. sorry.

> Anyway, what is preffered coding style for quagga?

See HACKING, mostly indent -nut (except it does nasty things to
initiliased array declarations).

With regard to space vs tabs: My preferred form of indentation on
principle is to use tabs, however too many people and too many
editors get it wrong or are inconsistent with each other. The source
code itself is vivid testament to this, even to individual lines that
use both tabs and space to indent (yuk). Space chars are the only
form of indentation that have a reasonably good chance of being
consistent.

See HACKING. (diffs welcome if you have changes).

> Best Regards,
>
> Krzysztof Olędzki

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
If anything can go wrong, it will.
Re: coding style [ In reply to ]
On Thu, May 13, 2004 at 02:58:16PM +0100, Paul Jakma wrote:
> With regard to space vs tabs: My preferred form of indentation on
> principle is to use tabs, however too many people and too many
> editors get it wrong or are inconsistent with each other. The source
> code itself is vivid testament to this, even to individual lines that
> use both tabs and space to indent (yuk). Space chars are the only
> form of indentation that have a reasonably good chance of being
> consistent.

Paul,

[.My comments should not take great weight, since I am not presently
contributing to Quagga development.]

I don't think that either of the characters has a greater chance of
being interpreted/typed correctly under all the editors out there.
You have to set a policy, stick to it, and remind people when they stray.
It is not unheard of for an editor to change a sequence of spaces that
ends on a tabstop into a tab---one of my co-workers used to have emacs
set up to do this. It was a problem until we set a policy.

A tab policy that has consistently and painlessly worked for me is
ASCII TAB interpreted as 8 spaces wide. The reasons are several.
Virtually all UNIX text utilities interpret a tab as 8 spaces "out
of the box." Also, in their default configuration, most editors both
display a tab as 8-spaces wide, and insert an ASCII TAB character when
the tab key is pressed. And regardless the sophistication of one's editor
configuration, one must expect some sort of rigamarole given any departure
from 8-space tabs encoded as ASCII TAB. For all those reasons, I think
that a reasonable style guide uses the default, 8-space wide ASCII TABs.

It can be painful to change styles, however, I reckon the pain
is inversely proportional to how strictly the current style guide
is enforced/followed. Last I read any Quagga sources, they were
inconsistently (or else eccentrically) indented. I don't know if that
was the prevailing condition. If that *is* the prevailing condition,
the sources might not be much worse off for having a "style flag day"
(I am thinking of reading CVS diffs) than to be left as-is or to be made
gradually consistent.

I favor the NetBSD style, myself. I have attached it. I have neither
the time nor the inclination to advocate for it. I simply put it out
there as one possibility out of many.

Dave

--
David Young OJC Technologies
dyoung@ojctech.com Urbana, IL * (217) 278-3933