C++ is platform independant, if you stick to the standard libraries, which is a minor problem for C++ in this context.
The main difference between Java and C++ in a network based progam is that there is no sockets support in the standard C++ library(or C for that matter). This is a good and a bad thing. Good because you actually have to learn sockets programming, Java abstracts it to the point where it is very easy to use, but you learn little. This implies that it is a bit more work. This also means that since you are directly using OS functions, it is not platform independant.
The main library for *nix OSes is the Berkley Sockets API. The main library in Windows in winsock, which is heavily based on Berkley, with just enough changes to break compatibility.
There are cross platform networking libraries available if platform independance is important to your project, many are free. Wxwidgets contains a networking library.
IO is a bit clunky in C++ compared to Java, but you don't need to get bogged down in pointers.
Both are great for networking, but if you are learning, stick to the langauge that doesn't hide as many details.
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Rusty, i think you have a different idea of what "platform independant" means than most people.
"Platform independant" as i understand it, means that you compile it once, and that same executable file can be run on any system (that has a JRE).
it does NOT mean that you write the code, and then compile it on 27 different machines to make 27 different binaries that each can only be run on a specific machine, even if they're all built from the same source code file.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Jan 03, 2006
Platform independant means that it will run on any platform that a compiler/interpreter is available for, with little to no code changes. I have had to slightly alter code twice to get a Java program to work correctly on Linux and XP, so by your definition Java is not platform independant.
Java is platform independant by this definition. So is standard C and C++.
Your defintion implies that only interpreted or hybrid(like Java) languages are platform independant. This is wrong, for two reasons. First is that standard C and C++ doesn't really care about the underlying OS, just like java, perl, ect. Second is that intrepreted languages suffer the same limitation as compiled languages, they don't(sometimes can't) have an interpreter for every platform.
lowercase comes from the fact that i seldom use the shift key when typing. While i was in the process of adopting my daughter, EFH changed my title to "dad to be". once the adoption was complete, he changed it again to "dad".
The term platform-independent isn't all that blurry: we usually mean "hardware and operating system environment."
The subjective part is in calling things platform-independent and asking whether that's helpful or not. The term suggests there's an advantage over other tools or programs that do the same work; it is not a classification that suggests code can be written totally regardless of the hardware/OS.
C/C++ can be written in a platform-independent manner. With all due respect to the sizeof() operator, however, they are not inherently platform-independent. Highly portable, yes.
Some people argue that Java is not 'truly' platform-independent either. As I see it, those arguments are academic. JDK-supplied classes generally don't require recompilation to run. There are exceptions, but to me this just means platform-independence isn't bulletproof.
The practical benefits of avoiding recompilation are substantial. Would you rather download a JAR file and get straight to work, or would you prefer providing a compiler, running make/ANT files, waiting a few minutes, and hoping everything works out? [ June 02, 2006: Message edited by: Michael Ernest ]
Make visible what, without you, might perhaps never have been seen. - Robert Bresson
Joined: Jan 03, 2006
Originally posted by fred rosenberger: lowercase comes from the fact that i seldom use the shift key when typing. While i was in the process of adopting my daughter, EFH changed my title to "dad to be". once the adoption was complete, he changed it again to "dad".
I see, that is a nice story. I hope all is going well.