This question arose as the result of a discussion on the reply to a question about platform-independence of PhysicsFS library. The question is whether particular code could be considered cross-platform or platform-independent? Should the code conform to certain standards or maybe just run on a particular set of platforms?
2 Answers
That's a very good question! I am venturing to guess here so bear with me as I don't have a definite answer really.
I think "platform independent" refers to code that is run by something that hides away the infrastructure. For instance the JVM hides the platform from the language -- there is nothing in the language that gives you access to the platform -- hence the platform independence. Cross platform I believe is something that is not shielded away from the details of the platform -- think JavaScript for instance : you have access to the browser and all of its quirks. So writing Javascript code to run on all browsers would be cross-browser -- and you can extrapolate this I think to "cross platform".

- 6,006
- 1
- 22
- 29
-
In your definition, Qt is also platform-independent, because the Qt libraries hide away all the `#ifdef`ed code. And Qt, in contrast to the C++ Standard Library, is not part of any language standard. – rubenvb Apr 20 '11 at 18:15
Platform-independent: if the compiler/system library/VM/etc... are standard conformant for that language/library/etc..., the code must compile/run on every future platform that adheres to the prescribed standard. This means that the code cannot use platform-dependent #ifdef
s anywhere, and that the program does not access API's not defined in said standard.
Cross-platform: this is kind of ambiguous, and mostly personal preference. For me, it means that it runs on at least two of the three big platform/OSes (x86(_64) Windows, Linux, and/or Mac). In most cases it will work on a lot more platforms and architectures, and use some or mostly POSIX API functionality (at least for non-Windows code). It will contain a limited number of #ifdef
s to call specialized API's for platforms that require it (posix vs win32 vs...).

- 74,642
- 33
- 187
- 332