Problem¶
When instrumented, a C/C++ file produces an error like
and the compilation fails.
Explanation¶
Most of the time, this error is caused by long "else if
"
chains like this:
For such "else if
" chains, the instrumented code generated
by Coco becomes deeply nested. Compilers often have a maximal depth of
nesting they can handle, so if the "else if
" chain is too
long, the compilation of the instrumented code fails.
Solution¶
To handle this, the chain can be broken up. The following code has the
same functionality as the code above, but now consists of two shorter
"else if
" chains: