Hacker News new | ask | show | jobs
by w8rbt 3463 days ago
All of that will come after rust gets an ISO standard (like C and C++). Joking aside, C++ will be around forever and to a lesser degree, C will be too. They have 45 years of experience and revision. 50 years from now they'll probably still run the world just as they do today. C++11 and beyond is just as safe as any language. Rust came to be about 10 years too late.
1 comments

> C++11 and beyond is just as safe as any language.

That's just not accurate. This is UB, despite being done entirely using modern C++ API:

    #include <iostream>
    #include <vector>
    using namespace std;
    
    int main() {
        std::vector<int> v;
        v.push_back(1);
        v.push_back(2);
        v.push_back(3);
        v.push_back(4);
        for (int i : v) {
            v.push_back(5);
            std::cout << i << std::endl;
            v.push_back(6);
        }
        return 0;
    }
I ran it on https://code.sololearn.com/caR4o14MOCWr/#cpp and got this output:

    1
    8519872
    3
    4