平台无关和跨平台有什么区别?

发布于 11-24 00:31 字数 140 浏览 7 评论 0原文

我见过很多C/C++库和Gui工具包。其中有一些像 GTK+ 、 Qt 、 Swing 等声称是平台无关的。而有些,如 WxWidgets、SWT 等,声称是跨平台的。起初我以为这只是措辞上的改变,但这些术语的使用如此一致,我开始怀疑。区别是什么?

I have seen a lot of C/C++ Libraries and Gui Toolkits. Among them there are some like GTK+ , Qt , Swing etc. which claim to be platform-independent. While some , like WxWidgets, SWT etc. which claim to be cross-platform. At first I thought it to be just a change in wording, but the terms have been used with such consistency that I have started to wonder. What is the difference?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

只是一片海2024-12-01 00:31:48

跨平台仅意味着您支持多个平台。它通常指 Linux、Mac 和 Windows。平台无关意味着您支持您的语言支持的任何平台 - 即,您不依赖于语言规范中未指定的行为。然而,这只是我个人的观点,大多数用法只是将它们两者都表示“多平台”,通常是“Windows 和......”。

Cross-platform only implies that you support multiple platforms. It usually means Linux, Mac, and Windows. Platform-independent implies that you support any platform that your language supports- i.e., you depend on no behaviour that is not specified in the language specification. However that's just my personal opinion and most uses just take both of them to mean "multiple platforms", usually "Windows and ...".

山色无中2024-12-01 00:31:48

就其价值而言,这是维基百科对此事的说法:

为了使软件被视为跨平台,它必须能够在多个计算机架构或操作系统上运行。

平台无关的软件不依赖于任何单一平台的任何特殊功能,或者,如果依赖,则处理这些特殊功能,以便它可以处理多个平台

For what its worth, this is what Wikipedia has to say on the matter:

In order for software to be considered cross-platform, it must be able to function on more than one computer architecture or operating system.

Software that is platform independent does not rely on any special features of any single platform, or, if it does, handles those special features such that it can deal with multiple platforms

后来的我们2024-12-01 00:31:48

“平台无关”通常是用高级语言编写的程序,不需要针对另一个平台重新编译或调整,并且可以“按原样”运行(Java、大多数 Perl 脚本等),只要特定平台实现语言运行时。当程序下面有处理不同平台(VM 或解释器)的层时,这是可能的。

“跨平台”意味着程序可以针对多个平台进行编译/调整,但不能针对任何平台。想想 C 和 C++ 代码中的 #ifdef

"Platform-independent" would usually be a program written in a high-level language that doesn't need recompiling or adjusting for another platform and can just run "as is" (Java, most Perl scripts, etc.) as long as the particular platform implements the language runtime. This is possible when there are layers below the program that deal with different platforms (the VM or the interpreter).

"Cross-platform" implies that the program can be compiled/adjusted for multiple platforms, but not for any platform. Think of #ifdef's in C and C++ code.

再见回来2024-12-01 00:31:48

跨平台意味着您的程序可以在不同的平台上运行,例如 Windows、Linux 和 Mac。

平台独立意味着您的代码一次编写,随处运行,即您不需要更改代码即可在不同平台上运行

所有平台独立程序都是跨平台的,但反之亦然 EM>

Cross-platform means your program can work on different platforms example Windows, Linux, and Mac.

Platform Independent means your code is Write once Run Anywhere i.e. you don't need to change your code to run on different platforms

All platform independent programs are cross-platform but vice versa not true

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文