You are viewing a single thread.
View all comments View context
0 points

This might be the wrong place for this question, but I have heard criticism that real rust programs contain lots of unsafe code. Is this true?

permalink
report
parent
reply
7 points

Define what makes a rust program “real” lol.

Any kind of library that does a lot of low-level stuff (kernel syscalls, custom binary reprs, ffi) will have to use unsafe. But most applications built using these libraries rarely need to use unsafe at all, because the libraries act as safe wrappers to make sure the app developer isn’t accidentally violating invariants allowed by the “unsafe” keyword.

permalink
report
parent
reply
4 points

Yeah. For example Lemmy backend is written purely in Rust and doesn’t use unsafe anywhere, but some lower-level library it uses probably does use unsafe for IO code.

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 7.2K

    Monthly active users

  • 954

    Posts

  • 36K

    Comments