[previous] MISRA C:2012  Rule-21.7:  (Required) [next] The atof, atoi, atol and atoll functions of <stdlib.h> shall not be used

Amplification:

The identifiers atof, atoi, atol and, for C99 only atoll, shall not be used and no macro with one of these names shall be expanded.

Example Code:


#pragma PRQA_MESSAGES_OFF 2983

#include <stdlib.h>

#include "misra.h"
#include "m3cmex.h"

extern int16_t rule_2107( void )
{
   float64_t dx;
   int16_t   ix;
   int32_t   lx;

   dx = atof( "12.34" );                        /* 5125 */
   ix = atoi( "3456" );                         /* 5125 */
   lx = atol( "12345678" );                     /* 5125 */

   return 1;
}


QAC messages that encompass this guideline:

5125 Use of function: atof, atoi, atol or atoll.



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