Giter Site home page Giter Site logo

Comments (7)

ZhangHanDong avatar ZhangHanDong commented on June 8, 2024 1

考虑改为:

得益于 LLVM 的优秀兼容性, Rust 程序,只需编写一次,就能够有效的跨平台编译执行,大多数时候用户无需考虑平台特定语义的问题。

from tao-of-rust-codes.

ZhangHanDong avatar ZhangHanDong commented on June 8, 2024

进一步修改:

Rust程序只需要编写一次,就能有效地跨不同的平台编译执行,大多数时候用户无需考虑各个平台的特定问题,这完全得益于LLVM的优秀兼容性。

from tao-of-rust-codes.

mzji avatar mzji commented on June 8, 2024

@ZhangHanDong 这个说法仍不准确,因为 LLVM 只是跨平台兼容性的一部分,其他部分还包括标准库、 rustc 中的设计等等

from tao-of-rust-codes.

ZhangHanDong avatar ZhangHanDong commented on June 8, 2024

@mzji 嗯,再考虑考虑

from tao-of-rust-codes.

mzji avatar mzji commented on June 8, 2024

Rust 从诞生伊始,就考虑到了平台移植性问题,并为此做了诸多努力:LLVM 作为底层的代码生成框架,具有良好的移植性;标准库 std 在设计时也注重兼容多平台语义;编译器 rustc 在实现中尽可能弭平不同平台间的微小差异;等等等等。以上这些举措,都是为了让程序员能够更加轻松的编写跨平台可运行的代码,大多数时候,用户无需考虑各个平台的特有性质,基本上做到一次编写,各处运行;而当用户需要处理跨平台兼容性问题的时候,rust 也提供了一些辅助的机制,以利于将不同平台的兼容问题包容在单个 crate 中解决。

from tao-of-rust-codes.

ZhangHanDong avatar ZhangHanDong commented on June 8, 2024

@mzji Nice!感觉描述到位了!

from tao-of-rust-codes.

ZhangHanDong avatar ZhangHanDong commented on June 8, 2024

@mzji

整段文字将修改为:

Rust从诞生伊始,就考虑到了平台移植性问题。通常编译阶段被分为前端和后端两部分,Rust作为编译语言,也是这样划分的。Rust编译器是一个编译前端,它的工作是对代码进行词法分析、语法分析、类型检查、生成中间代码、进行独立于目标机器的优化等工作。使用LLVM作为编译器后端代码生成框架,则可以利用LLVM兼容多个目标机器的特性,实现跨平台编译和优化等工作。所以,在用户使用Rust时,大多数的时候,无需考虑各个目标机器平台的特有性质,基本上可以做到一次编写,到处运行。而当用户在需要处理跨平台兼容性问题的时候,Rust也以第三方crate的形式,提供了诸多辅助。

from tao-of-rust-codes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.