9.4.1 不同表示
01-不同表示 — Comprehensive Rust
1分钟内可阅读完
译文 · 基于 Comprehensive Rust
原文链接: https://google.github.io/comprehensive-rust/unsafe-deep-dive/ffi/language-differences.html
╭────────────╮ ╭───╮ ╭───╮ ╭────────────╮
│ │ │ │ │ │ │ │
│ │ <-----> │ │ <~~~~~~~> │ │ <------> │ │
│ │ │ │ │ │ │ │
╰────────────╯ ╰───╯ ╰───╯ ╰────────────╯
Rust C C "C++"
以 C 作为最小公倍数意味着 Rust 与 C++ 的许多丰富特性都会丢失。
每次转换都可能带来语义损失、运行时开销与隐蔽 bug。
01-不同表示 — Comprehensive Rust
02-不同语义 — Comprehensive Rust
03-Rust 与 C — Comprehensive Rust
04-C++ 与 C — Comprehensive Rust
05-Rust 与 C++ — Comprehensive Rust