C Programming Guidelines

Thomas Plum

Publisher: Plum Hall, 1984, 145 pages

ISBN: 0-911537-03-1

Keywords: Programming

Last modified: March 21, 2022, 12:10 a.m.

Drawing upon his work with dozens of companies producing products in C language, Dr. Plum has provided a style standard for projects working C language. For anyone working in this terse, powerful "implementer's language", these guidelines are valuable aids to the production of efficient, portable programs which can be understood and maintained by other programmers.

Arranged in a "manual-page" format for easy reference, these guidelines can help a project reach agreement about matters of style and usage of C language. Issues of both lexical layout and more fundamental semantics are covered for variables, data types, operators, expressions, statements, functions, files, libraries, and documentation. Differences among some common C compilers are covered in an appendix to assist with portability across compilers.

C Programming Guidelines will be useful to any C programmer who desires to write portable, maintainable, professional C programs.

  1. Introduction
    1. Standards and guidelines
  2. Data and Variables
    1. Lexical rules for variables
    2. Choosing variable names
    3. Standard defined-types
    4. Maintainability of constants
    5. Word and byte size
    6. Byte ordering
    7. Character constants
    8. Pointer types
    9. Pointer conversions
  3. Operators
    1. Lexical rules for operators
    2. Allowable dependencies on evaluation order
    3. Bitwise operators and parentheses
    4. Right shift and unsigned data
    5. Order of side effects
  4. Control Statements
    1. Lexical rules for control structures
    2. "while" and the N+1/4 - time loop
    3. Designing with loop invariants
    4. Multiple-choice constructs
    5. Restrictions on control structures
    6. Program structure and problem structure
  5. Functions and other Modules
    1. Lexical rules for functions
    2. Project-wide standard header files
    3. Size for source files
    4. Includes at head of file
    5. Standard compile-time flags
    6. Nested include-files
    7. No initializations in header files
    8. Methods of coupling modules together
    9. Cohesion and meaningful functions
    10. File structure for library functions
    11. Use of portable library
    12. Non-portable environment features
    13. Suggested size of functions
    14. Writing macros
    15. Defined-types for structures
  6. General Standards
    1. Avoiding non-portable compiler features
    2. Suggested use of comments
    3. Specifications
    4. Code reviews
    5. Defensive programming
  7. Appendix
    1. Features of UNIX C Compilers
    2. Features of Whitesmiths C Compiler
    3. Features of Data General AOS/VS C compiler
    4. Features of Prime C Compiler
    5. Features of Digital Research C Compiler
    6. Features of Lattice C Compiler
    7. Features of Computer Innovations C Compiler
    8. Features of Manx C Compiler
    9. References
    10. Index

Reviews

C Programming Guidelines

Reviewed by Roland Buresund

Mediocre **** (4 out of 10)

Last modified: May 21, 2007, 2:56 a.m.

Stiff programming tips. Valid, but must it be presented this dull?

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required