4 ms·
The general rule of thumb is to ensure you've returned to safety guarantees before exiting an unsafe block. Obviously it's too much to expect humans to be perfe
by stouset 3y ago
The general rule of thumb is to ensure you've returned to safety guarantees before exiting an unsafe block. Obviously it's too much to expect humans to be perfect at this, but having that mentality makes it orders of magnitude harder to leak UB into safe code. The overwhelming majority of violations I've seen are where engineers dip in and out of unsafe code without upholding safety guarantees inbetween.
- galangalalgol 3y agoThe one I usually see is an unsafe method leaving memory aliased.
- WirelessGigabit 3y agoCan you share an example so I know what to look for?
- galangalalgol 3y agoIf an unsafe function borrows an input make sure it doesn't return an aliased reference to the same data.