LoginSignup
10
6

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-06-29

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

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

コードゴルフ風

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

結論

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

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

10
6
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
6