Conventions / Recommendations for Better Integration

software

References

Project Structure

Source Directory package (use lowercase and add '-' and version to filename) :

prefered :

  • Debian , note that last - preceade version number )

tar cfvz package-name_1.2.0.tar.gz package-name-1.2.0/

zip package_name-1_2_0.zip package_name-1.2.0/

Avoid :

PackageName or package_name for dir and archives

makefile hints :

${PACKAGE}-$(VERS).tar.gz:
@ls $(SRC) | sed s:^:${PACKAGE}-$(VERS)/: >MANIFEST
@(cd ..; ln -s ${PACKAGE} ${PACKAGE}-$(VERS))
(cd ..; tar -czvf ${PACKAGE}/${PACKAGE}-$(VERS).tar.gz `cat ${PACKAGE}/MANIFEST`)
@(cd ..; rm ${PACKAGE}-$(VERS))

Please provide those additional files :

  • COPYING : a copy of the Licence, check http://opensource.org
  • AUTHORS : all authors and contibutors
  • README : short description
  • INSTALL : how to install
  • NEWS : new features, since last package

Sources

  • line length must not exceed 79 characters (75 preffered emails , 77cols*50row for a4)
  • indentation should be carried out by <space> characters only

(no <TAB>, as this is interpreted very differently between editors)

  • indentation: Emacs-C-mode-style (tab=2 chars)

this is also easy to achieve with “indent” without any parameters (GNU style), exceptions (not mandatory):

  • on MSVC : Tools / Options / Edit / C++ : indent=block tab=space , tab=2 ident=2

Preferred :

  • no trailing white space at the end of a line
  • no DOS line endings (not CRLF but just LF)

Software : http://sourceforge.net/projects/astyle/

[[Java]]

[[C]]

  • all preprocessor definitions/macros are starting CAPS
  • filenames lowercase

Usefull decoration (note the 80 cols delimitor and RCS keywords )

/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* #ident "$Id: myfile.h,v 1.1 YYY/MM/DD HH:MM:SS ${USER} Exp $"
/* Author: ${LOGNAME} <${EMAIL}>, (C) YYYY - $Author:$
/* Copyright: See README file that comes with this distribution
/****************************************************************************/
#ifndef MyFile_h_
#define MyFile_h_
#endif
/* vi: set ts=4 sw=4 expandtab: */
/* #eof "$Id: myfile.h,v 1.1 YYY/MM/DD HH:MM:SS ${USER} Exp $" */

[[CPlusPlus]]

see C

//* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
//* vim: ft=cpp:expandtab:ts=2:sw=4:softtabstop=4:
//* #ident "$Id: file.h,v 1.1 YYY/MM/DD HH:MM:SS ${USER} Exp $"
//* SPDX-Licence-Identifier: GPL3+
//* Author: ${LOGNAME} <${EMAIL}>, (C) YYYY - $Author:$
//* Copyright: See README file that comes with this distribution
//****************************************************************************/
#ifndef ClassName_h_
#define ClassName_h_
class ClassName
{
public:
 void functionName();
 void functionContents()
 { //<= jump to funct
   if ( true ) { // comment
       int a=42;
    } //<= aligned with if statetement 
 }
protected:
 char* p_name_;
};
#endif
/* #eof "$Id: file.h,v 1.1 YYY/MM/DD HH:MM:SS ${USER} Exp $" */
file.h # namespace "foo" { #include "foo.hpp" } 
file.hxx # templates + .cxx for implem

Other Languages

Try to reuse previous conventions without overloading default ones

static char THIS_FILE[[]] = **FILE**; // [[WinCE]]

ViM : GnuMake :

# ex: set tabstop=4 noexpandtab:

Python :

# -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*-

TODO

MISC

MORE

convention.txt · Last modified: 2020/09/22 11:51 by rzr
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki