Join the DZone community and get the full member experience.Join For Free
Of course, not all C/C++ code can be converted for running on the web, but a lot should be possible. Games are a perfect example of applications that will benefit enormously from innovations in this area. There's currently a lot of source code out there for game logic such as physics engines, but most of that is written in C/C++. Emscripten has the potential to massively alleviate the conversion process for making those games available on the web.
While Google Chrome's Native Client runs native code on the browser through a plugin and features hardware acceleration, Emscripten doesn't require a plugin and its code can run on more than just Chrome. The downside is that Emscripten compiled code is currently about 20 times slower than NaCl. However, at this early stage, there is plenty of room for optimizations. We should see that gap narrow over the next few months.
Here are some of the features of C/C++ that can compile already:
- Control flow stuff (loops, ifs, even gotos)
- Everything else inside tests/runner.py, and the .cpp files in that directory
Check out a generated code comparison for Emscripten here.
Opinions expressed by DZone contributors are their own.