[previous] 0604 [next] [C99] Declaration appears after statements in a compound statement.
ISO C99 Language features REFERENCE - ISO:C90-6.6.2 Compound Statement, or Block - Syntax

A declaration has been encountered in the middle of some executable statements. This syntax is not permitted in ISO:C90 but is allowed in ISO:C99. In C90, all declarations within a block must be located at the start of the block and before any executable statements.

For example:


/*PRQA S 2017,2211,3121,3199,3203,3408 ++*/

extern void foo(void)
{
  int i;

  i = 1;

  float f;                /* Message 0604 */

  f = 2.5F;

}


MISRA C:2012 Rules applicable to message 0604:

Dir-1.1  (Required) Any implementation-defined behaviour on which the output of the program depends shall be documented and understood


QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents