[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNU-COBOL] standards & practices



Since there seem to be confusion on the coding standards.
I have written up a short description of the stds for this project.
For clarification more rules will be added as needed.
the file is CVS:Cobol/doc/dev/std_prc

The Cobol Project Standards and Practices.

1) All code will be Readable and Maintainable.

2) All code will compile under the GNU cc compiler with no warnings or
   errors using the following flags: -Wall 
   The following flags are HIGHLY suggested, if you use them and get a
   warning a technical justification will be required.
   Extras: -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations

3) Any code that uses heap memory will need to be linked against a memory
   leak detection package(such as dmalloc) and run with no leaks.

4) All code will have comprehensive unit tests written for it.
   All tests written will be come part of the codes complete regression
   test suite. All tests will pass all unit tests, BEFORE it is allowed
   in CVS. 
  
5) All C code will be Ansi & Posix compliant. except no using trigraphs.
   All Java & NetRexx code will be Java 1.1 compliant.

6) Naming for all externally visible entities in runtime and outputted
   code will be prefixed With "Cobol<libraryname>__" 
   Note: That is Two(2) underscores after the prefix.

7) As the issue was brought. I see no conflict between the GNU coding standard
   and the first rule.

7a) 18 - Code formatting beyond 80 columns and needs to be "folded" 
   Rewrite the code so "folding" isn't necessary.
7b) 20 - All pointer declaration need to be on a line by them self.
   Ex:  char * one, *two;   /* this is a no-no */
        /* better way */
        char *one;
        char *two;
7c) 21 -  variable names.
   It suggests the use of underscores as separators in C. BUT
   Variable names should use mixed case, instead of underscores.



Books to reference for readable & maintainable code.
   The C programming Language 2nd edition, K&R
   Writing Solid Code, Maguire.
   Large Scale C++ Software Design, Lakos
   POSIX Programmer's Guide, Lewine



-- 
Chad Slaughter  -- slaught at umr.edu
<PGP public key available upon request>

--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to gnu-cobol@acm.cs.umr.edu with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@acm.cs.umr.edu.