为什么此C ++代码会编译? (字符串)名称= 1;

时间:2018-07-22 07:45:13

标签: c++ string types

为什么此C ++代码会编译?

#include <iostream>
#include <string>

int main()
{
    std::string name;
    name = 1; // <== No error here???

    std::cout << "Hello, " << name << "!\n";
}

甚至没有警告! (经过VC ++和g ++测试)。请在回答中包括对标准的引用。谢谢。

0 个答案:

没有答案
相关问题