C ????: use const for data from the library that shall not be modified

Submitter:Philipp Klaus Krause
Submission Date:????-??-??

Summary:

use const for some data from the library that shall not be modified.

There are 4 functions (getenv, localeconv, setlocale, strerror) in the standard library that return a pointer and state that the return value points to something that "shall not be modified by the program". The correct way to state this would be to make the return value pointer-to-const. This would communicate the intent more clearly even to users, and make it easier for implementations to diagnose bugs.

Do we want to change the return type of these 4 functions to const char *?

Proposed changes: §7.11.1.1: "char *setlocale(int category, const char *locale);" to "const char *setlocale(int category, const char *locale);". §7.11.2.1: Change "struct lconv *localeconv(void);" to "const struct lconv *localeconv(void);". §7.22.4.6: Change "char *getenv(const char *name);" to "const char *getenv(const char *name);". §7.24.6.2: Change "char *strerror(int errnum);" to "const char *strerror(int errnum);".