首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么遵循c++11程序崩溃visual 2013 expresss版本?

为什么遵循c++11程序崩溃visual 2013 expresss版本?
EN

Stack Overflow用户
提问于 2014-08-14 04:53:19
回答 1查看 213关注 0票数 1

下面是导致VS2013特快版崩溃的程序。同样的程序在gcc4.8上也能成功地编译和运行。在我看来,这是对窃听器的攻击。

代码语言:javascript
复制
#include<iostream>
#include<string>

struct x
{
public:
    std::string s{};
    //Does not crash if we replace above line with below one
    //std::string s{"VS2013"};
    int i{10};
public:
    x()  = default;
    ~x() = default;
    x(const x& rhs) = default;
    x& operator=(const x& rhs) = default;
};


int main()
{
    x a;
    std::cout << a.s << std::endl;
    std::cout << a.i << std::endl;
    return 0;
}

我想知道我的假设是正确的还是遗漏了什么。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-14 05:03:23

安装vs 2013的最新服务包。它应该消失。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25300327

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档