3 ms·
Right now, C++ is less portable than Java..., that really have this ‘write once, run everywhere’ thing. As someone who's currently rewriting a massive Java pro
by zelos 11y ago
Right now, C++ is less portable than Java..., that really have this ‘write once, run everywhere’ thing.
As someone who's currently rewriting a massive Java project in C++ so we can port it to other platforms, this made me laugh.
It reminds me of that physicist joke about spherical cows. "Assume a working JVM..."
- reacweb 11y agoI have the migration studies for a big software base containing C++ code, Ada code and Java code (around 30% each). The migrations were from HPUX to RedHat4, then to RedHat5, then to RedHat6. Each time, more than 90% of the migration workload was on the C++ code.
- z92 11y agoMaybe that's because C++ was used mostly for system level calls, and low level jobs.
- qb45 11y agoOne advantage of Java is huge standard library with basic support for important OS-specific things like filesystem, threading, GUI, time, etc. You don't get all the bells and whistles of your OS, but you can write portable code which works and does some simple things expected to be possible "everywhere". C++ only recently is starting to go there.
- zelos 11y agoInteresting. Is that still the case if you go in with the intention of writing portable code, though? Or was it just a case of taking a large single-platform piece of code and porting it? The main issue is that Java's portability has hard limits. C++'s may require work, but it is at least (in theory) almost always possible.
- reacweb 11y agoI have the migration studies for a big software base containing C++ code, Ada code and Java code (around 30% each). The migrations were from HPUX to RedHat4, then to RedHat5, then to RedHat6. Each time, more than 90% of the migration workload was on the C++ code.
- pjmlp 11y agoThe fun of C++ portability starts when one needs to make the code portable across multiple compilers instead of the usual gcc, clang and msvc. Java was an welcoming bless when it appeared in terms of code portability. Writing portable C++ code in the days of pre-ANSI C++98 was a mess.
- sgift 11y agoA classic case of "there is an exception to every rule" - sure, if your target platform has no JVM then you are screwed, but how often does this happen for projects where Java is well suited? (e.g. Please, do not answer with "well, we have an embedded platform" .. This is simply not what Java - today - is build for, despite the fact that it began as a language for embedded devices a long time ago)
- greydius 11y agoIf C++ is really so portable, then why don't you just compile openjdk to your other platforms instead of rewriting all the Java code?