Next: FORTRAN code
Up: Coding rules
Previous: Coding rules
C code
Code written in the C language must conform to the
ANSI definition of the Programming Language C as specified in
ISO/IEC Std. 9899-1990[5]. In addition, the following
rules must be followed:
- Structures and unions must be defined by typedef
declarations.
- Structures must always be passed to or returned by functions
using pointers.
- Include files may not contain executable code statements.
- Each module must contain a comment header block which defines
name, purpose, author, version etc.
(see Section ).
- All modules using the interfaces defined in Appendix A must include
the header file 'midas_def.h' which contains standard
definitions and proto-types.
- Use of proto-types is encouraged however they should be made
conditional on the definition of the '__STDC__' variable
so that code still can be complied with K&R compilers.
To make the code easier to understand, the usage of frequent comments,
meaningful variable names and spaces between elements are recommended,
whereas goto statements are strongly discouraged. The
portability of the code must be verified by using the UNIX lint
utility or a similar tool. Any potential problems reported by this
utility must be corrected.
Next: FORTRAN code
Up: Coding rules
Previous: Coding rules