News for hackers. Stuff that matters.
Re:Rav1e: An experimental AV1 video encoder, designed to be ... by pcwalton on Monday July 16, 2018 @08:51PM (#17546452)
> I'm not sure your first point is actually right - it tends to be pretty hard to use after move.

    std::unique_ptr<int> foo(new int(10));
    
    void bar(int& x);
    
    int main() {
        bar(*foo);
        return 0;
    }
    
    void bar(int& x) {
        foo = std::unique_ptr<int>(new int(20));
        std::cout << x; // use after free
    }
No warnings on any warning level.

There are no comments on this comment yet.