Originally posted by darkonix
View Post
People keep saying references can't be null. But they can. There's absolutely zero guarantee the caller doesn't supply you a null reference, just like passing a null pointer. And that leads to a crash which is just the same as an assertion...?
The fact Rust has only "smart pointers" while those are just an optional thing (i.e. programmer's choice) in C++ kinda proves which one is superior (it's not Rust since it forces you to one thing).
Originally posted by darkonix
View Post
Originally posted by darkonix
View Post
There's an alternative to do type punning without union in C/C++ but it requires compiler extensions (may_alias attribute). I don't see how having to cast and use such types is any different than an "unsafe" block...?
Leave a comment: