"As an alternative, you can also use Emscripten to "compile C and C++ code into JavaScript and run that on the web"
Yeah, if you don't mind making everything 100x - 200x slower, you can do it that way. Hand optimised JS is still order of magnitude slower than Java/C++, and automatically generated JS is another order of magnitude slower than hand optimised JS.
Not really (see the demos), and chances are it's faster than handwritten JS:
Q. How fast will the compiled code be?
A. Right now generated code is around 3-4 times slower than gcc -O3, however, note that there are substantial differences between benchmarks, and in some cases JS engine bugs cause significantly poorer performance. See http://syntensity.com/static/splashpres.pdf (slides from a SPLASH 2011 presentation) for more details. docs/paper.pdf also has some numbers, but they are out of date.
Emscripten-compiled code can run at similar speeds to handwritten JavaScript code in many benchmarks. While hand-crafted code can in theory do everything Emscripten does and more, in practice such code is written for clarity. Compilers, like Emscripten or gcc, emit fast code which is not necessarily easy to read, hence in some cases compiled code can be faster than handwritten code.
Benchmarks, yeah. The problem is that more complex JS code, like e.g. the one used here: www.circuitlab.com, is dead slow compared to native counterpart. It is nowhere near 3-4x slower than gcc -O2. They use *simpler* models than SPICE, yet most C++ or Java based SPICE-like programs are >50x faster.
Let me clarify. Is C++ and Java all you need since C++'s intended use is non-web-based stuff and Java's intended use is web-based stuff? I'm taking about in general excluding the fact that there's tons of code written in other languages)
No. Both Java and C++ are general purpose languages. None of them is primarily indended for some kind of use, however there are applications for which one is better suited than the other. I'd say for complex stuff, requiring solving algorithmic chalenges (e.g. like a simulator or database engine or CAD system) none of them is good enough.
I'd say for complex stuff, requiring solving algorithmic chalenges (e.g. like a simulator or database engine or CAD system) none of them is good enough.
That's strange, I was under the impression that Java and C++ are the languages that are most commonly used for that kind of task.
I got my info from here. http://en.wikipedia.org/wiki/Comparison_of_programming_languages Then again it does say Business Apps, I guess that's what you guys are taking about. Hey I didn't notice this before but it says "de facto" under the standardized portion regarding Java, does that mean it's the English equivalent to programming languages in terms of popularity?
it says "de facto" under the standardized portion regarding Java, does that mean it's the English equivalent to programming languages in terms of popularity?
It simply means that there is no standard for Java (unlike C++ for example), but the specification maintained by Oracle acts as a standard, de facto.
It simply means that there is no standard for Java (unlike C++ for example), but the specification maintained by Oracle acts as a standard, de facto
Huh? It really doesn't matter to anyone if something is ISO/ANSI standard i.e. a standard on paper. Paper standards don't count and it is very easy to create them. Much more important is, whether implementations implement the specification fully and correctly, and whether the standard is really used in industry. C++ fails at both - all major C++ compilers implement it only partially (GCC, ICC, VC++) and in industry lot of C++ code is not standard compliant (but works).
Additionally there is no standard for ABI in C++, while Java has one. Which makes it hell lot harder to provide portable libraries in other form than a bunch of header/source files.
BTW: the specification is not maintained by Oracle. It is maintained by JCP, which is a very similar organization to C++ standarisation commitee. JCP is led by Oracle, but involves several other big companies like Google, Microsoft (sic!) or RedHat, as well as a dozen of individuals.
I would question it, the only reason Windows could be considered the "best" platform for PC gaming is because it already is the platform that is most commonly used for PC gaming.
Huh? It really doesn't matter to anyone if something is ISO/ANSI standard i.e. a standard on paper. Paper standards don't count and it is very easy to create them.
Disagree. It matters to me a lot, since it implies the language is not owned by a single proprietary entity. With the current legal battles of Oracle v. Everyone (Google most recently) the issues of vendor lock-in in case of proprietary languages like Java (and the risk they pose for businesses like Google: no matter what the outcome turns out to be, they've already spent significant revenue on the legal battles) have come to the spotlight.
When I was bored on ISO lectures in college, I thought international standards don't matter either.. then I got a job.
there is no standard for ABI in C++, while Java has one
No, Java has a vendor specification for ABI. C++ has those as well. As for an ABI standard, it would make no sense for C++ (or C for that matter) to have one. Anyway, this is going far offtopic again.
Oracle lawsuit is *not* about Java-the-language. Java specification, as well as JVM specs is public and open. Even the reference implementation is opensource (OpenJDK) and developed with help of community.
The lawsuit is about their JVM implementation *not adhering to the standard* and breaking copyright and patents. Google *copied* some copyrighted code from Apache Harmony, which they didn't have the license for. Oracle grants you free patent licenses as long as you adhere to the standards created by JCP. Otherwise you have to obtain a license.
Exactly the same threat exists for any language compiler/runtime provider, including C++. Create your own compiler, use a patented by <insert big company name here> optimisation / algorithm or worse, copy some source code of a different compiler / library you don't have written permission, and you are screwed, at least in US, where you can gain sometimes ridiculous patents on algorithms.