Re: Debian coding style?
On 7 May 1999, Amy Fong wrote:
> Query, is there actually a coding style guideline for debian stuph?
> Basically I'm with the Corel Linux group and this is what the Corel
> Linux Coding guidelines say... (follows). A few note-worthy ones are:
> - tabs: 2 spaces
> - curly braces alway on next line
> ie if (...)
> - hungarian notation
> Will the Debian community be excrusiatingly unhappy with this?
Probably not. There is no Debian standard. There are two widely-used
standards in free software: the GNU standard (Emacs default, see GNU web
site) and the Linux kernel standard
(/usr/src/linux/Documentation/CodingStyle). Most people seem to write with
a style heavily influenced by one of these, though everyone has their own
Your standard looks much closer to the GNU standard than the Linux one.
Basically the linux standard squishes the code vertically by putting
braces on the same line as the code, but expands horizontally by using
8-space indent. The GNU standard is horizontally squished with 2-space
indent but all spread out vertically due to the braces.
You'll probably find spaces instead of tabs more convenient when working
with a diverse group of people with random editors; spaces are less likely
to get mangled. (I use (setq-default indent-tabs-mode nil) in .emacs to
avoid tabs. You can remove tabs from a region with M-x untabify.)
It's also conventional to preserve the author's coding style when
submiting patches. That is, on your own projects it's fine to use the
Corel standards, but it would be kind of bad to submit Corel-style code
to a project that consistently used a different style (since the author
would have to reformat it).