I was reading documentation for the std::getenv()
function on cppreference.com and it says
Modifying the string returned by getenv invokes undefined behavior.
Then why does the function not return a const char*
?
Then why does the function not return a
const char*
?
Probably because of compatibility with older c standards that don't support const
at all.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.