Chrome 14 Beta Integrates Native Client 209
derGoldstein writes "This year Microsoft kept signaling that it's going back to lower-level code with a C++ renaissance. It would give C++ programmers the same priority that was, up until now, reserved for .Net programmers. They even launched a new show about it on their Channel9. Now Google wants to appeal to native programmers with their Native Client for Chrome. It seems the two companies want to cover both the higher-level JavaScript and lower-level C/C++. I dare hope this will give seasoned C/C++ programmers a place alongside JavaScript programmers at the web development table."
Yeah, I'm so excited (Score:3, Insightful)
I dare hope this will give seasoned C/C++ programmers a place alongside JavaScript programmers at the web development table.
Yeah, nothing thrills me more than the prospect of a language with absolutely no memory safety or bounds checking being exposed to the public Internet. What could possibly go wrong?
Re: (Score:2)
you mean like when the browser itself is exploited in the same manner by crafted javascript?
the only way to truly secure 'the web' is to remove the ability to script browsers beyond basic formatting that can be done in html.
honestly if we're gonna keep javascript, I wouldn't mind seeing C++ as well..
Re:Yeah, I'm so excited (Score:5, Informative)
I suggest that you read about how NaCl actually works before commenting. It is a sandbox for native code. It doesn't run just any code, either - there are certain constraints in place which make it possible to verify the result for safety. "Safety" here means that code cannot break out of the sandbox - it can, of course, still crash itself, but that would be fully isolated, and cannot be used in the usual manner as a privilege escalation exploit.
Re: (Score:2)
"Safety" here means that code cannot break out of the sandbox - it can, of course, still crash itself, but that would be fully isolated, and cannot be used in the usual manner as a privilege escalation exploit.
Or that's the idea, [google.com] anyway.
Re: (Score:2)
Re: (Score:2)
The crazy thing is that process isolation as provided by operating systems is relying heavily on hardware support. Most processors only have a kernel mode and a user mode and the mode switching is a part of what isolates processes. The 80386 was cleverly designed to have 4 modes, called rings, 0 to 3, where each inner ring would have more privileges than the outer rings. This was at a time where most of the OS makers ended up looking at this design and scratching their heads in wonder, having no idea how to
Re: (Score:2)
The original paper makes an explicit assumption that OS process/sandbox isolation boundary is not foolproof.
Re: (Score:2)
Sure, but similarly JavaScript interpreters (and even more so modern JIT-compiling VMs such as V8) can have exploitable bugs, including code injection. Heck, even an HTML parser can be vulnerable, if written in C or C++!
The trick is to make strong sandboxes. Formal proofs help there. There are a few of those in NaCl paper.
Re: (Score:2)
I'm guessing you haven't used any languages other than C++. Aside from having a lot of libraries (not all of them good, mind you), the benefit of time (to understand all of the inane quirks of the language and make compilers that are almost halfway decent) and its performance (which other languages are catching up to), it's not a pretty language, it's not elegant, it's not easy, it's not orthogonal. It has a lot of warts and misfeatures. If it weren't for the fact that you can write fast code in C++, I d
Re: (Score:2)
Now for my subjective viewpoint: I program using whatever language has better support for the task. I wouldn't use C++
Re: (Score:2)
well... (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
netbeans is a quite powerful c++ IDE and contrary to VS it is multi-platform. Have a look at that http://netbeans.org/images_www/v7/screenshots/cnd.png [netbeans.org]
Re: (Score:2)
Re: (Score:2)
And given how poorly Oracle has handled Java as a platform, it's future is becoming questionable.
That is so true, they shipped Java 7 with a shipload of bugs, I stumble upon one today. And I am pretty sure that i am not the only one as there was a guy in a Minecraft complaining about the same exception.
They have killed a lots of cool research project that I cared about, Microsoft would have funded them as they would have originated from there Microsoft Research Labs. I miss Sun; I might switch to the Microsoft completely and byte the C# apple. Almost all the good library from Java are ported. And it s
Re: (Score:2)
Re: (Score:2)
Xcode 4.1 has that ability.
Re: (Score:2)
Xcode is still GCC 4.2. MSVC 10 has most of the nice features of C++11:
http://wiki.apache.org/stdcxx/C++0xCompilerSupport [apache.org]
Re: (Score:2)
XCode will soon be updated with the baseline of LLVM 3.0/Clang 3.0/LLDB/LibC++ probably around October or November. C99 is 99% compliant in Clang and C++ is humming along with C++ and C++0x support: http://clang.llvm.org/cxx_status.html [llvm.org]
By the way, Chrome uses LLVM/Clang to build against.
Re: (Score:2)
It has always amazed me that no other compilers do "as you type" compilation, since the difficulties are, while not trivial, quite easy to surmount. You can construct grammar trees and fill them online. During my CS study we built such realtime parsers in one of the courses as an assignment. This was in 1990.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Unfortunately, Eclipse still tends to choke on C++ code a lot in my experience. I'm not writing particularly devilish C++ code, but I still find that it just gives up in situations when it clearly shouldn't. Code folding is starting to misbehave all of a sudden when editing files, sometimes Eclipse has no clue what possible completions are, although it did a fine job discovering two lines above the current one etc. I really wished this thing was more robust. It would help me alot.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
http://mariusbancila.ro/blog/2011/06/20/cpp-renaissance-at-microsoft/ [mariusbancila.ro]
http://herbsutter.com/2011/07/28/c-renaissance-the-going-native-channel/ [herbsutter.com]
http://channel9.msdn.com/Shows/Going+Deep/Craig-Symonds-and-Mohsen-Agsen-C-Renaissance [msdn.com]
It's true that MS it starting to push JavaScript/HTML5, but there's also a "return to roots" movement for C++.
Re: (Score:2)
This rumor appears to be based on nothing more than the fact that in showing off a demonstration of new features of Windows 8, they showed off the ability to run HTML5+JS desktop apps (which, unlike the ability to run .NET apps, is a new features of Windows 8) and not the ability to run .NET apps.
Re: (Score:2)
I think you misunderstand what NaCl is. It is not some kind of C++ interpreter or VM; it does not "support C++ features". It runs native code. Said native code can be the output of a compiler of any language - there are some restrictions on what the output can look like (e.g. opcodes must be aligned), but there's no inherent restriction on languages. Today, Google supplies a C++ compiler (modded Clang? not sure what it is) that respects those constraints, but anyone can do so as well, including VC++.
And, of
Re: (Score:2)
Said native code can be the output of a compiler of any language - there are some restrictions on what the output can look like (e.g. opcodes must be aligned), but there's no inherent restriction on languages. Today, Google supplies a C++ compiler (modded Clang? not sure what it is) that respects those constraints, but anyone can do so as well, including VC++.
I guess in theory there's nothing stopping any compiler from outputting NaCl binaries, but at present none does, except for the aforementioned Google toolchain that comes with the NaCl SDK (which is a modded version of GCC). Code output for NaCl carries the extension ".nexe" -- technically it is native machine language, but the binary won't execute anywhere but inside NaCl. The SDK and its APIs are also changing a lot; .nexes compiled with earlier versions of the SDK won't work with Chrome 14 or later. [google.com]
I kic [infoworld.com]
Re: (Score:2)
I actually suspect it may be possible to write a translator that'd take a PE or ELF binary compiled with a normal compiler, and convert it to NaCl - replacing instructions and padding them as necessary.
Re: (Score:2)
The above is not valid NaCl, since any indirect jump is encoded as a pair of AND/JMP instructions to ensure that the destination is 32-bit-aligned. Instructions cannot straddle 32-bit word boundaries, either (padded with NOP as needed). Thus, it is guaranteed that no jump will happen into the middle of an instruction. You can make it jump to the wrong instruction, but since we're dealing with segmented memory here, at worst you'll fuck up your own data and/or stack, and eventually segfault (which the sandbo
interpreter/VM (Score:2)
" It is not some kind of C++ interpreter or VM"
Actually, everything that's not kernel code "runs in a VM". Operating systens do memory address translation and bounds check (i.e. not violating other processes memory) during runtime.
Re: (Score:2)
Re: (Score:2)
Given their love for Eclipse in Android development department, I'd expect them to just ship it with Eclipse CDT.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
I guess it's a matter of taste.
I find that Visual Studio is very unintuitive and impractical for the way I code in C++.
In that category, I've had better experience with Eclipse.
With some work, you can probably use any compiler you want, since it directly executes machine cod
Re: (Score:2)
albeit in a custom executable format, and I couldn't find information about the ABI...
As I understand it, there are two formats. I remember the nexes being derived from ELF, but I can't find it now. There's also the Portable NaCl, which is some form of LLVM bytecode, so that it can be compiled on the client so as to natively support any architecture, without having to ship them C source.
Please don't use C/C++ (Score:3)
C++, especially modern C++, is such a different language from C, that it makes no sense to talk about them as if they are the same. A decent programmer can learn everything they need to know about C in about two weeks. Modern C++ really takes years to really master. When I interview programmers, I'm immediately skeptical of anyone who claims to know "C/C++". Often, this means the most advanced "C++" feature they use is the // comment.
Re: (Score:2)
Re: (Score:2)
"C/C++" is not meant to imply that the languages are almost the same, or anything like that. Rather, it's the recognition that these two are the most popular languages that are compiled directly to native code, by a very large margin. Another aspect of this is that many C++ programs use C libraries (SDL, zlib etc).
Re: (Score:2)
Re: (Score:2)
that is so true. I know C99 and C++ (but I did use C++ since 2001) and they are quite different.
And C++ only takes year to master if you try to know all the obscure corner case. If you don't abuse the template system as a turning complete language interpreted by the compiler, use operator overloading in a limited way, avoid reinterpret_cast, use variable scope for memory allocation and shared_ptr from boost when you really have to have a new, it is a fine language.
Re: (Score:2)
I meant did not use c++ since 2001
Re: (Score:2)
The phrase "C/C++", that is.
C++, especially modern C++, is such a different language from C, that it makes no sense to talk about them as if they are the same. A decent programmer can learn everything they need to know about C in about two weeks. Modern C++ really takes years to really master. When I interview programmers, I'm immediately skeptical of anyone who claims to know "C/C++". Often, this means the most advanced "C++" feature they use is the // comment.
And C99 isn't your C89 equivalent nor is C1x the same as C99. With C99 being the baseline for OpenCL I expect C1x will be a big boon for Parallel Programming.
Re: (Score:2)
Re: (Score:2)
#include
using std::va_list;
va_list list; // for storing information needed by va_start
va_start( list, count );
for ( int i = 1; i <= count; i++ )
total += va_arg( list, double );
va_end( list );
Re: (Score:2)
That #include should have been
#include <cstdarg>
Yo Dawg (Score:2, Funny)
I heard you like programming, so I put some programming in your program so you can program your program while you're programming.
Re: (Score:2)
Will never fly (Score:2)
So wrong in so many ways... (Score:2)
This is the new ActiveX,
It's got a sandbox. ActiveX didn't. ActiveX is for writing plugins; this is for building faster webpages.
only without a dominating monopoly
Google doesn't dominate search?
and OS integration
Granted, it's not integration into a monopoly OS, but it's integrated into Chrome OS.
Now, on to the real points:
There are just too many architectures capable of browsing the web now,
Really?
I count three that anyone cares about anymore: ARM, x86, and x86_64. If you're feeling generous, PPC and PPC64. And if you compile one nacl binary for, say, x86, that'll run on Windows, Linux, and OS X. Only reason the x86_64 plugin doesn't do the same (yet
Consistancy! (Score:2)
First a story about how .Net is being ignored. And now a story whose headline claims MS has been giving priority to .Net.
Ahh, slashdot.
Re: (Score:2)
C++ blows on multi-core and multi-platform (Score:2)
Re: (Score:2)
to make it work with the new multi-core CPU architectures is a total PITA.
HFT industry disagrees. But those devs keep quiet, they do need sluggish C-pound lovers on the other side of the trade to make money.
Re: (Score:2)
My first commercial banking web site (Score:2)
I wrote was in C. My next in C++
It's harder, but the results are faster. Not that it matters anymore, but in 1995 it sure as hell did.
Re: (Score:2, Insightful)
C++ on the web. That worked so well last time [wikipedia.org]
Re:C++ Making its way to the web? (Score:5, Interesting)
The original ActiveX in IE was designed with practically complete disregard for security. NaCl is the opposite of that - it's a very cleverly designed sandbox for native code.
Re: (Score:2)
Making sure there's no problems with Javascript is easier than checking native code. Yet there's still flaws with that parser, enough so that most browsers have a "workaround" of "disable JavaScript". Why do you think this will be better?
Re: (Score:3)
Of course, verifying and sandboxing JS is easier. However, JS is not high-perf enough for many real-world applications. The question then becomes whether it is possible to sandbox native code without some mindboggingly complicated scheme. And the answer is yes - and I invite you to read the NaCl research paper [chromium.org] for details. The scheme is, in fact, surprisingly simple - less so than e.g. bytecode verifier for CLR.
Is it really the parser? (Score:2)
So, Chrome already sandboxes JavaScript in some of the same ways that they'd sandbox NaCl, but it's not the parser. JavaScript is a relatively simple language, syntactically, and any decent implementation isn't going to be fucking around with it on that level.
My guess is that it's a choice of which APIs you expose and when they're allowed to be called. Since JavaScript can't generate code which ultimately does anything other than call methods or access properties, it entirely comes down to which methods or
Re: (Score:2)
Re: (Score:2)
Let me know when they replace Javascript with Forth! :-) ....I'm not holding my breath! :-)
ttyl
Farrell
Re: (Score:2)
Yes, because what I really want to do is use a language that is terrible at string processing! If this were perl, python, or ruby, I might care. I'd rather learn javascript from scratch, than do string processing in C/C++.
Not going to be limited to C/C++ for long (Score:2)
If you can run compiled C/C++ code in the browser, you can use pretty much any language you want, since "compiled C/C++ code" includes the compilers and interpreters for most other languages as well. I'm sure there will be implementation tweaks needed to many existing language implementati
Comment removed (Score:4, Insightful)
Re: (Score:2)
Re: (Score:2)
Chromium is open source.
And yes, it's cross-platform and actually sandboxed. Unlike ActiveX, this actually would be a reasonable alternative to JavaScript.
Re: (Score:2)
Note that NaCl code is only cross-platform in the sense that it's OS-independent. Being true native code, it's not processor-independent; if you want NaCl modules to run on x86, x64, and ARM, for example, you need to have compiled three separate versions of your NaCl binary, one for each architecture.
PNaCl addresses this concern (Score:2)
For now; though with NaCl now in a non-dev version of Chrome (its been in dev versions since 7 or so, I think) that probably means that there is going to be more focus on getting PNaCl (Portable Native Client)
Re: (Score:2)
For now; though with NaCl now in a non-dev version of Chrome (its been in dev versions since 7 or so, I think) that probably means that there is going to be more focus on getting PNaCl (Portable Native Client) ready for public consumption, which will see code deployed on the web as LLVM bitcode and compiled to native code at the client, at which point you'll have real portability.
It is still not clear how much portability PNaCl will give, and at what performance cost.
Let's say that it supports x86, x86_64 and ARM. Is that enough? I would argue not, because it puts a big limitation on what future architectures can look like - because LLVM bitcode is not truly portable, it still encodes many assumptions about current architectures.
Of course JavaScript does as well - everything does. But JavaScript has far fewer such assumptions, making it much easier for someone to invent a new
Re: (Score:2)
Last time I tried regular-old NaCl, the startup time for NaCl modules was already significant. Really the whole experience reminded me of nothing so much as Java applets circa 1997. I'm sure performance can be enhanced in various ways, but at this point I'm still skeptical that NaCl will have much more appeal than Java did back then. The reason ActiveX was successful was because it exposed a lot of Windows functionality for browser-based apps -- it wasn't just wedging an immature platform into a little box
Re: (Score:2)
NaCl is not, in my view, a replacement for JavaScript, its a tool for certain purposes for which JavaScript is problematic (one might be re-use of substantial legacy code bases that aren't in JavaScript, but otherwise might be useful in browser-based applications -- in the long-term, you might wa
Re: (Score:2)
Java and C#, which are considered 'fast enough'.
Not for games or video processing.
Re: (Score:3)
Re: (Score:2)
Just when we seemed to get a standard web browsing experience
We did? I still see a lot of "-webkit-" etc in CSS for those new and shiny HTML5 websites.
Re: (Score:2)
Re: (Score:2)
Define standard. If you mean standards-based, we're there. Many of the vendor prefixed CSS properties are initial implementations of standards, and many of them have since graduated to actual standards. Even the ones that are made up by a vendor (like the canvas element) are written up, submitted, improved and adopted; a far cry from attempts to insert a box with a new environment in the middle of everything (ActiveX, Silverlight, Flash, Java; the list goes on). NaCl looks like a more well-meaning version o
Re: (Score:2)
Oh sure, things are much better than they were even 4 years ago. Just saying that we're not quite there yet, and won't be until all the features of HTML5 that are necessary for rich apps are standardized (at least de facto, across all major implementations). I'd say, give it 3-4 more years...
Re: (Score:3)
I don't see it that way. There is no argument that Google is web company, and people can only experience the web through the browser, which means that the features that the "average" browser supports is a limiting factor in what Google can do.
I've always seen Chrome as a way for Google to stimulate other browsers to be better and drive innovation. Every since Chrome came onto the scene, showing off its fast rendering and javascript engine, other browser companies have had to step up their game, which is g
Re: (Score:2)
I've always seen Chrome as a way for Google to stimulate other browsers to be better and drive innovation. Every since Chrome came onto the scene, showing off its fast rendering and javascript engine, other browser companies have had to step up their game
That's true, and that may have been the initial intent, but they've been pushing the Chrome browser like practically no other product of theirs. A Chrome ad appears on Youtube pages very frequently, in several formats, and "types" of ads (some are animated, some are still images saying something like "browser faster"), and they keep making oddball viral-ish Chrome campaigns. I can't think of any product they push this hard (although Google+ may change that).
Chrome market share has [gigaom.com] been [arstechnica.com] rising inexorably s
Re: (Score:3)
It's not just a tech demo anymore. They want the browser market.
Ah, yes... that lucrative, lucrative browser market.
Re: (Score:2)
The browser market might not be the most lucrative, but there is some return on one's investment.
Re: (Score:2)
Re: (Score:3)
Do I really need to explain why it's beneficial to own the leading browser? The leading browser sets the agenda
That's not what you just said, though. You said Google "wants the browser market," in rebuttal to a guy who basically said Google made Chrome as a way to set the agenda (causing other browser vendors to "step up their game" in the process). Google still makes 100 percent of its money from Web sites, not browsers. As such, it still does not benefit Google to create a browser full of nonstandard things as a way to "own the browser market." The more different browsers that can use Google's Web apps, the more G
Re: (Score:2)
And yes, I think that people are being naive. I can't know what the original intention was on the first day they started working on Chrome. At that point, they may well have wanted the other browsers to accelerate their development, and comply with standar
Re: (Score:2)
You're basically asking Google: "would you like to have Firefox's market share?". Do you really think they'd say "no"?
That's what I'm saying.
As long as there's no direct profit to be had from gaining Firefox's market share, it's not a discussion that comes up at meetings at Google.
Re: (Score:2)
First, if we're going for semantics, you said "that lucrative, lucrative browser market", which implies (since you were being sarcastic) that there's no money to be made by having more people using your browser. In the macro sense, this just isn't true.
Sorry to reply twice, but how is it not true? Right now, what makes producing Firefox "lucrative" for the Mozilla Foundation is .... (drum roll please) ... royalties from Google from searches powered by the Firefox search bar. That's it. 97 percent of Mozilla's income derives from that one source: Google. Google obviously profits even more from the same searches, though, or it wouldn't have the money to pay the Mozilla Foundation. That's business.
But wait! Google would profit even more if it didn't have to
Re: (Score:2)
Judging by the documentation it doesn't even have access to the DOM..
Sure it does.
The Native Client module. This module uses the Pepper Library, included in the SDK, which provides the bridge between the Native Client module code and the web page JavaScript and DOM. Currently, the SDK supports the C and C++ languages. When compiled, the extension for this filename is .nexe.
Re: (Score:2)
NaCl has access to the DOM via the "bridge" you mention, but in practice what that means is that NaCl's access to the DOM is handled through inter-process communication calls. Google has said that games that rely on a lot of DOM access would probably be better off being written in JavaScript for this reason. The two technologies are clearly meant to be complementary.
Re: (Score:2)
Re: (Score:3)
The sandboxing on NaCl actually is relatively incredible. Only a modified subset of x86/amd64/arm is executed - potentially unsafe instructions are not. It's actually a lot like (para)virtualization. Read about it:
http://en.wikipedia.org/wiki/Google_Native_Client [wikipedia.org]
http://code.google.com/chrome/nativeclient/faq.html#PreventBreakouts [google.com]
Re: (Score:2)
Right now, this seems to be intended for "Chrome web apps" (which also run on Chromebooks), not as a general purpose extensibility mechanism.
Re: (Score:2)
Wow, that's so meta. How many beowulf clusters will be needed for that?
Re: (Score:2)
Just wait until next month when they're in the triple-digits...
Am I using Chrome 143 or 142? ARGH!
Re: (Score:2)
History says you can program the same performance and capability as C++ in .NET, Java, C#, Scala, Ada, and Haskell
What does history say about cross-platform support? Or the availability of a huge existing codebase? Or the fact that practically every major software project [att.com] is developed using C++?
.Net is getting gently walked off the plank by
If you want to put your money on Scala, be my guest. There's always a cool-new-thing, and it's usually fun to play with. But where's your paycheck coming from? If it's Java or C#, then start updating your resume. Java's legal crap (and Oracle crap) is pushing companies away, and