开发者

What is the difference between Platform-Independent and Cross-Platform?

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 th开发者_开发百科at I have started to wonder. What is the difference?


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 ...".


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


"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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜