Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • Really annoying when people take 50 year old C code and modern C++ code and just drop them into the same bucket and refer to them as if they're the same thing. The CURL example they give has multiple modern C++ solutions that accomplish the same thing without UB.
  • Memory safety is a concern, but there are many solutions that don't include Rust. Rust is certainly one solution, though.

    However, Rust seems to trade memory safety vulnerabilities for supply chain risk.

  • I'm not sure i think those situations are comparable. If a rust func is taking an Option<t>, its essentially advertising that it can handle None values. That feels quite a bit different from giving a c function a null pointer and having it freak out.
  • There can be made very good arguments why C is less safe than Rust, but null pointer dereferences which are perfectly safe everywhere except on weird platforms (and usually could be made safe even there by turning on a compiler flag) seems a very misleading argument.

    And as as the Cloudflare incident showed, a Rust unwrap can have equally bad consequences. (or as Ariane 5 showed, a safe overflow in Ada can have explosive consequences)

  • Is it only me that would have expected curl_getenv() to have an assert that it's argument isn't NULL?

    I know this doesn't stop runtime problems in release builds, but i'd have thought this sort of simple precondition check would help users find problems in their library useage.

    It's not going to stop you passing a non-terminated string, or other such invalid input though, which is I guess more the point, that it's totally possible in C to produce good looking but actually invalid arguments that can't be spotted at runtime without UB (out of bounds access etc).

    Edit: Actually thinking about this more, I guess the problem is that you are likely linking against a release library implementation, so it's not possible to add a precondition without introducing a runtime overhead, which is probably more likely what we are talking about with this case.

  • C and C++ are kind of losing out to Rust right now.

    Take ladybird (last month blog; not that ladybird stands for all projects out there, of course; it is just an example):

    https://ladybird.org/newsletter/2026-05-31/

    "The HTML parser is now written in Rust" "The Rust parser is also about 10% faster than the C++ version it replaced,"

    I am not saying this is a systematic analysis by far, but Rust is pushing into domains where C and C++ dominated in the past. And that seems to be a real push. To me it looks as if both C and C++ are standing to lose some ground in the next few years, directly to Rust. Perhaps even via snowball effect.

  • >Because sometimes I see people online who compare the number of CVEs in Rust and C/C++ software, [...]

    a rule of thumb i follow is that the second someone starts comparing or talking about the number of CVEs, i just ignore whatever they say next. its hard to think of a more useless metric than "number of CVEs", especially now.

    (edit: the people disagreeing are encouraged to share how you use "number of CVEs" to inform your decision making)

Explore Birbla archives