logoalt Hacker News

bangaladoreyesterday at 6:22 PM2 repliesview on HN

I think part of the problem is people start thinking that unsafe code with a SAFETY comment nearby is probably safe.

Then the safety comment can easily bias the reader into believing that the author has fully understood the problem and all edge cases.


Replies

webstrandyesterday at 6:27 PM

The SAFETY comment is just a brief description of the important points the author considered when writing the block, and perhaps points you need to consider if you modify it. Do people just blindly assume that comments in an algorithm are correct and not misleading? In other languages they don't, I don't see why rust'd be any different.

show 1 reply
Kinranyyesterday at 6:37 PM

> unsafe code with a SAFETY comment nearby

That's roughly 100% of unsafe code because a lint in the compiler asks for it.