Proposal for SAMBA_3_0/README.Coding

Gerald (Jerry) Carter jerry at samba.org
Tue Jun 26 04:45:57 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Folks,

Attached is a very basic coding formatting guide.  There
are no surprises.  It's pretty much what we do now and
copied from the prog_guide.txt that Tridge started in
SAMBA_4_0.  This just spells out the 80 column rule,
tab indention, no trailing whitespace, and standard K&R
formatting.  I'm not looking to institute a format police
team.  Just enough to give everyone an idea of what is
expected.

I've added a reference section to be filled in later
as needed for standard idioms that everyone should follow.
But I don't see any need to go overboard now.  This
should be lightweight enough that it doesn't make life
harder for us.  Fight the battles you can win I always
say and I think this is minimal enough that everyone can
agree.

If we get a majority consensus, this file will go in
all current SAMBA_3_0 branches.  And if anyone working
on the SAMBA_4_0 tree would like to adopt a single
style guide file for all branches, that would be fine
as well.






cheers, jerry
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGgJoFIR7qMdg1EfYRAqeqAKDVJ5+HkONNn7wrQV8K8As0zOvnMgCgx0ax
SajypzYo3TX7U2orlkIj43A=
=RWLC
-----END PGP SIGNATURE-----
-------------- next part --------------
##
## Coding conventions in the Samba 3.0 tree
##

===========
Quick Start
===========

Coding style guidelines are about reducing the number of unnecessary
reformatting patches and making things easier developers to work together.
You don't have to like them or even agree with them, but once put in place
we all have to abide by them (or vote to change them).  However, coding
style should never outweigh coding itself and so the the guidelines
described here are hopefully easier enough to follow as they are very
common and supported by tools and editors.

The basic style, also mentioned in the SAMBA_4_0/prog_guide.txt is the
Linux kernel coding style (See Documentation/CodingStyle in the kernel
source tree).  The closely matches what most Samba developers use already
anyways.

But to save you the trouble of reading the Linux kernel style guide, here
are the highlights.


* Maximum Line Width is 80 Characters
  The reason is not for people with low-res screens but rather sticking
  to 80 columns prevents you from easily nesting more than one level of
  if statements or other code blocks.  Use source/script/count_80_col.pl
  to check your changes.

* Use 8 Space Tabs to Indent
  No whitespace filler.

* No Trailing Whitespace
  Use source/script/strip_trail_ws.pl to clean you files before committing.

* Follow the K&R guidelines.  We won't go throw them all here.  You have
  a copy of "The C Programming Language" anyways right?  You can also use
  the format_indent.sh script found in source/script/ if all else fails.



===================
Statement Reference
===================

To be filled later in as needed.


More information about the samba-technical mailing list