Some functions return a pointer to an object that cannot be modified without causing undefined behavior. These functions include the standard getenv()
, setlocale()
, localeconv()
, asctime()
, and strerror()
functions. In such cases, the function call results must be treated as being const
qualified.
...
Altering the string returned by strerror()
results in undefined behavior 184.The asctime()
function is addressed in rule MSC33-C. Do not pass invalid data to the asctime() function.
Noncompliant Code Example (getenv()
)
...