[previous] 0715 [next] [L] Nesting of control structures (statements) exceeds 15 - program does not conform strictly to ISO:C90.
ISO C90 Conformance limits REFERENCE - ISO:C90-5.2.4.1 Translation Limits

The translation limits specified in the ISO:C Standard define a minimum set of conditions which a compiler must support in order to be described as conforming. In practice, compilers will often tolerate code which exceeds these minimal requirements. However, in order to ensure portability, it is advisable to avoid writing code that assumes a level of compiler capability which may not always be supported.

Message 0715 identifies situations where the level of statement nesting exceeds the minimum requirement of the ISO:C90 Standard. Message 0371 identifies code which breaches the corresponding ISO:C99 limit; however it should be noted that the definitions of nesting differ in the 2 standards.

The ISO:C90 specification for statement nesting requires a compiler to support 15 levels of blocks where blocks are defined as follows: Consider the following code example:

if ( x > 0)
{
   ...
}

This will correspond to a nesting level of 2 (1 level for the if statement and 1 level for the compound statement within it). It is therefore not difficult to exceed the ISO limit of 15. In practice, most compilers will support a much more liberal nesting limit and therefore this limit may only be relevant when strict conformance is required.

By comparison, ISO:C99 specifies a limit of 127 "nesting levels of blocks", but, as noted above, the definition of nesting is rather different.

Note also that the algorithm used to calculate the STMIF metric ("Maximum nesting of control structures") is different yet again. The STMIF metric is incremented in iteration and selection control statements but not in compound statements. This algorithm corresponds more directly with the nesting levels conventionally represented visually by code indentation.

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents