[dpdk-dev] [PATCH] doc: add coding standards documentation

Bruce Richardson bruce.richardson at intel.com
Wed Jun 3 12:43:18 CEST 2015


On Tue, Jun 02, 2015 at 02:59:24PM +0200, Thomas Monjalon wrote:
> 2015-05-13 16:30, Bruce Richardson:
> > Add coding standards document to guides directory. This document
> > codifies the current DPDK C coding conventions, to make it easier for
> > contributors to see the format their code should be in.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> > Signed-off-by: Siobhan Butler <siobhan.a.butler at intel.com>
> 
> Thanks for your work.
> It would be nice to apply this doc baseline shortly in order to be able to
> update it, one change at a time.
> 
> > new file mode 100755
> 
> wrong file mode
> non-Linux filesystem spotted ;)
> 

Ooops, my secret is out! :-)

> > index 0000000..b2e522e
> > --- /dev/null
> > +++ b/doc/guides/coding_standards/index.rst
> > @@ -0,0 +1,806 @@
> > +Coding Style
> > +=============
> > +
> > +Description
> > +-----------
> > +
> > +This document specifies the preferred style for source files in the DPDK source tree. It is based on the Linux Kernel coding guidelines and the FreeBSD 7.2 Kernel Developer's Manual (see man style(9)), but was heavily modified for the needs of the DPDK.
> > +
> > +General Guidelines
> > +------------------
> > +
> > +The rules and guidelines given in this document cannot cover every situation, so the following general guidelines should be used as a fallback:
> > +
> > +* The code style should be consistent within each individual file.
> > +* In the case of creating new files, the style should be consistent within each file in a given directory or module.
> > +* The primary reason for coding standards is to increase code readability and comprehensibility, therefore always use whatever option will make the code easiest to read.
> > +
> > +Line length is recommended to be not more than 80 characters, including comments. [Tab stop size should be assumed to be 8-characters wide].
> 
> Don't you think we should wrap lines a little to make future changes easier to review?
> In general, there is no reason to put more than 1 idea or sentence on 1 line.
> Don't forget that carriage return are ignored when rst docs are built.
> 

Ok, I'll have a quick scan through to see how I can improve things. I agree one
sentence per line is best.

> > --- a/doc/guides/index.rst
> > +++ b/doc/guides/index.rst
> > @@ -45,3 +45,5 @@ Contents:
> >     sample_app_ug/index
> >     testpmd_app_ug/index
> >     rel_notes/index
> > +   coding_standards/index
> > +
> 
> 1 byte to save ;)
> 

I'll fix that in the V2

/Bruce


More information about the dev mailing list