logoalt Hacker News

dvtyesterday at 11:02 PM4 repliesview on HN

Let's say you want to call win32 (or Mac) OS functions, all of a sudden you're doing all kinds of wonky pointer stuff because that's how these operating systems have been architected. Doing unsafe stuff is pretty inevitable if you want to do anything non-hello-world-ish.


Replies

Jtsummersyesterday at 11:04 PM

> Doing unsafe stuff is pretty inevitable if you want to do anything non-hello-world-ish.

So the vast majority of Rust projects involve writing at least one unsafe block? Is that really your claim?

show 1 reply
josephgyesterday at 11:29 PM

Making use of win32 functions doesn't turn off bounds checking in your rust code.

dralleyyesterday at 11:41 PM

A tiny fraction of programs need to use win32 or Mac OS functions beyond the standard library or other safe wrappers for said functions.

amlutoyesterday at 11:03 PM

So what? Just because you used the keyword `unsafe` to call an unsafe API does not mean that you are going to use unsafe pointer access to write to a vector.