C/C++的坑,供以后翻出来看看

<<角斗士>>有一句台词很好,“士兵,好久不练,你的剑被冻住拔不出来了!”
//一,新项目开始重构老项目代码才发现这个bug
    std::string s = "something";
    std::string r = "some";
    int n;
    if( n = s.find_first_of(r) != std::string::npos )
    {
        s.replace(n, r.size(), "other");
        cout << s << endl;
    }

//二,也是个坑,先记着,供以后翻出来看看
    int x = 2;
    if( x & 1 == 0 )
    {
        cout << "equal 0";
    }

//三,2个多月查出来一个crash,廉颇老矣!

猜你喜欢

转载自www.cnblogs.com/printk/p/9823482.html