[previous] MISRA-C:2004  Rule  20.9:  (Required) [next] The input/output library <stdio.h> shall not be used in production code.
This includes file and I/O functions fgetpos, fopen, ftell, gets, perror, remove, rename, and ungetc.

Streams and file I/O have a large number of unspecified, undefined and implementation-defined behaviours associated with them. It is assumed within this standard that they will not normally be needed in production code in embedded systems.

If any of the features of stdio.h need to be used in production code, then the issues associated with the feature need to be understood.

Example Code:


/* PRQA S 2983,3203 ++ */

#include <stdio.h>                      /* MISRA Violation */
#include "misra.h"
#include "m2cmex.h"

extern S16 test_2009( void )
{
   FILE *fp;

   fp = fopen( "test", "r" );

   return 0;
}


QAC messages that encompass this guideline:

5124 The input/output library <stdio.h> shall not be used in production code.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents