←back to thread

In Defense of C++

(dayvster.com)
185 points todsacerdoti | 1 comments | | HN request time: 0s | source
Show context
kronicum2025 ◴[] No.45268740[source]
The safety part in this article is incorrect. There's a google doc somewhere where Google did an internal experiment and determined that safety c annot be achieved in C++ without an owning reference (essentially what Rust has).
replies(1): >>45274115 #
Attrecomet ◴[] No.45274115[source]
Am I missing anything in the article about this problem in particular? Owning references are a part of modern C++, which should be covered by the author's arguments.
replies(3): >>45276325 #>>45277006 #>>45348935 #
aw1621107 ◴[] No.45276325[source]
> Owning references are a part of modern C++

Maybe we're thinking of different things, but I don't think C++ has owning references, modern or not? There's regular references (&) which are definitely not owning, and owning pointers (unique_ptr and friends), but neither of those quite match Rust's &.

replies(1): >>45300122 #
1. Attrecomet ◴[] No.45300122[source]
Ah, okay, that is a good point. I was not aware of that subtle difference, and replaced "owning reference" with "owning pointer" in my mind.