❝HN 片单

CppCon 2017: Louis Brandy “Curiously Recurring C++ Bugs at Facebook”

CppCon · 3 位 HN 用户推荐 · 2020–2025

  1. "unique_lock<mutex>(m_mutex);" has no effect, but you might mistakenly think that this will block on m_mutex. Labeling unique_lock's constructor as [[nodiscard]] would force you to think twice. See [2] for more details. [1] [link]
    — wyldfire, 2020
  2. - Like you said, Rust doesn't let you data race on the contents of an Arc. - Rust also doesn't let you data race on the Arc itself (i.e. repointing a global Arc without synchronization). This is Bug #5 in this great talk: [link]
    — oconnor663, 2023
  3. There’s a great talk by Louis Brandy called “Curiously Recurring C++ Bugs at Facebook” [0] that covers this really well, along with std::map’s operator[] and some more tricky bugs. An interesting question to ask if you try to watch that talk is: How does Rust design around those bugs, and what trade offs does it make? [0]: [link]
    — ddulaney, 2025

← HN 片单