5 ms·
Am I necessarily always allowed to convert a reference to a numeric address?
by alkonaut 2y ago
Am I necessarily always allowed to convert a reference to a numeric address?
- Rusky 2y agoYes, it's safe to cast a reference to a raw pointer and a raw pointer to an address. It might have been nicer in some ways if the language had restricted that a bit more up front, but it would probably have taken some design work to do that while still supporting a lot of the low-level stuff people need to do.
- alkonaut 2y agoAn internal reference could only be cast to a relative memory offset. It’s not a global memory address in disguise like a normal reference. So the same casting rules wouldn't apply.