9
top 2 comments
sorted by: hot top new old
[-] username_1@programming.dev 5 points 5 days ago

Null-safety guarantee

Nothing stops you from deleting the object from memory and you have no methods to mark reference as not valid.

[-] scratchee@feddit.uk 1 points 4 days ago

Yeah. References feel like they were originally made to be safer but any safety the could have provided got sacrificed to the compiler for a little more speed, leaving them more dangerous than pointers with the illusion of safety.

That said, compilers are starting to get support for more hardening options now that c/c++ has to care about memory safety, I imagine this might be partially covered by that eventually (eg crash when assigning null to a reference, there's realistically no saving dangling references though)

this post was submitted on 12 Apr 2026
9 points (100.0% liked)

C++

2266 readers
2 users here now

The center for all discussion and news regarding C++.

Rules

founded 2 years ago
MODERATORS