[previous] MISRA-C:2004  Rule  20.11:  (Required) [next] The library functions abort, exit, getenv and system from library <stdlib.h> shall not be used.
These functions will not normally be required in an embedded system, which does not normally need to communicate with an environment. If the functions are found necessary in an application, then it is essential to check on the implementation-defined behaviour of the function in the environment in question.

Example Code:


/* PRQA S 2983,3203 ++ */

#include <stdlib.h>
#include "misra.h"
#include "m2cmex.h"

extern S16 test_2011( void )
{
   S16         i;
   PC         *v;

   i = system( "test" );       /* MISRA Violation */

   if ( i < -99 )
   {
      abort();                 /* MISRA Violation */
   }

   if ( i == 40 )
   {
      exit( 1 );               /* MISRA Violation */
   }

   v = getenv( "test" );       /* MISRA Violation */

   return 0;                   /* MISRA Violation */
}





QAC messages that encompass this guideline:

5126 The library functions abort, exit, getenv and system from library <stdlib.h> shall not be used.



(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