Help us understand the problem. What is going on with this article?

Rustを5行でセグフォらせる

Pythonで流行ってる1らしいのでRustでやってみました。

main.rs
fn main() {
    unsafe {
        *(0x012345 as *mut i32) = 0x0000;
    }
}

コードゴルフ風

main.rs
fn main(){unsafe{*(1 as*mut _)=0}}

結論

  • システムズプログラミング言語なので簡単に出来て当たり前。
  • Rustは明示的に非安全なコードを書けるのでデバッグフレンドリー

これより簡単または最短コードがあれば教えてください。

YoshiTheChinchilla
Just a Rustacean. I recommend to use dev.to or Stack Overflow instead of Qiita.
https://www.mozilla.org
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした