== Why is this an issue?

``++<stdlib.h>++``'s ``++atof++``, ``++atoi++``, and ``++atol++`` functions, which convert strings to numbers, have undefined behavior when the strings cannot be converted, and should therefore be avoided.


=== Noncompliant code example

[source,cpp]
----
int converter (const char * numstr) {
  return atoi(numstr); // Noncompliant
}
----


=== Compliant solution

[source,cpp]
----
int converter (const char * numstr) {
  return strtol(numstr, NULL, 10);
}
----


== Resources

* MISRA C:2004, 20.10 - The library functions atof, atoi and atol from library <stdlib.h> shall not be used.
* MISRA {cpp}:2008, 18-0-2 - The library functions atof, atoi and atol from library <cstdlib> shall not be used.
* MISRA C:2012, 21.7 - The atof, atoi, atol and atoll functions of <stdlib.h> shall not be used
* https://wiki.sei.cmu.edu/confluence/x/C9cxBQ[CERT, ERR34-C.] - Detect errors when converting a string to a number

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove this use of "xxx".


endif::env-github,rspecator-view[]
