为什么getenv()返回一个非常量字符串 [英] Why does getenv() return a non-const string

查看:170
本文介绍了为什么getenv()返回一个非常量字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 std :: getenv() / program / getenvrel =nofollow> cppreference.com ,它说

I was reading documentation for the std::getenv() function on cppreference.com and it says


修改getenv返回的字符串未定义的行为。

Modifying the string returned by getenv invokes undefined behavior.

那么为什么函数不返回 const char *

Then why does the function not return a const char*?

推荐答案


那么为什么函数不返回 const char *

可能是因为与不支持 const 。

这篇关于为什么getenv()返回一个非常量字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆