...
Code that is only expected to run on a particular subset platform of platforms should have that platform those platforms mentioned in the code's section header, e.g.: Compliant Solution (POSIX). Likewise, code that is only expected to run on more modern versions of C should indicate the oldest standard that supports them, e.g.: Compliant Solution (C99).
In order to compile the code, you will need to include appropriate header files. For example, if the code invokes malloc()
, you may need to include the stdlib.h
header.the code, you will need to include appropriate header files. For example, if the code invokes malloc()
, you may need to include the stdlib.h
header.
Many coding examples must lead with some variables initialized to valid values. If any code example (compliant or non-compliant) requires a local variable to be initialized with an unspecified but valid value, then that code should be wrapped inside a function that takes the variable as a function argument. Consequently, unless otherwise noted, function arguments should be assumed to point to valid values. For example, character pointers should not be NULL, but rather point to valid null-terminated byte strings. Checking that function arguments are valid is important, and is described in detail in recommendation API00-C. Functions should validate their parameters. However, the code involved with checking argument validity would be redundant across all code examples, and so function arguments in these code examples are not validated.
Many code examples will contain ellipsis in comments. This indicates that the comment may be replaced by arbitrary code that satisfies the comment. A comment with only ellipsis suggests that the code may do anything.
...
Most guidelines have a small bibliography section that lists documents and sections in those documents that provide information relevant to the guideline.