Feeds

Stroustrup on next-gen C++: I didn't want to let go of my baby

Badly taught, over-used... better than ever

New hybrid storage solutions

C++ 11 is “far better than previous versions”, says the inventor of the language Bjarne Stroustrup. He was speaking at an online event marking the launch of Embarcadero's C++ Builder XE3, a rapid application tool targeting Windows and Mac OS X.

C++ Builder XE3 is a promising but curious product. Delphi and C++ Builder were successful because the tools offered fast native code performance and high productivity on Windows. Embarcadero is now striving to make them cross-platform tools, via a new framework called FireMonkey that supports Windows and OS X, with iOS and Android promised in 2013. To keep pace with C++ changes, Embarcadero has adopted a new 64-bit compiler front-end for XE3, based on the open source compiler front end Clang.

C++ is an ISO standard, first ratified in 1998 with C++ 11 completed in 2011, but Stroustrup revealed he was initially resistant to standardisation efforts.

“It took some arm-twisting to get me to realise that it was time to start a standards effort," he said. "People pointed out that you couldn’t have a language used by millions controlled by a single guy in a single company. Even if you could trust the guy, you can’t trust the corporation. I was a bit sad, because the things I wanted to do would take years instead of months, because you have to build up consensus, and then you have to wait for five compilers to catch up.

“On the other hand the fundamental argument is correct. If you want something that is really widely used, you need some kind of standard. As languages grow, if they’re owned by a single organisation, sooner or later they start taking on peculiar twists to support that organisation’s business plan. The allies of that corporation are favoured.

“A lot of the languages that are seen as competitors to C++ are owned by a single corporation, but they do tend to fight with all the other corporations, and portability is a really hard thing to achieve. It has always been difficult, but it is not getting any easier, and I think portability across platforms is a very big deal.

“When people get into these stupid language wars like what’s best C++ or Java, I can’t be that rude, since most of the major Java implementations are C++. Same with C#. Same with the browsers and such. It’s a big world and many languages are useful.”

Despite its wide usage, C++ is among the most complex programming languages and hard to learn. Stroustrup says the solution is not to attempt to learn everything, and that C++ 11 is easier than before.

“A lot of people look at C++ and want to understand every dark corner. This is what you do if you want to be a compiler writer, but most people should look at what is the easiest way to write a good solution for their problem," said Stroustrup.

“I try to focus on things that lead to correct programs fairly easily. I emphasise the use of constructors to establish invariance, to acquire resources, destructors for cleaning up, copy operations, and the new [C++ 11] move semantics that allow you to move an object out of one scope and into another one very cheaply," he added.

"One of the things that was limiting C++ 98 [the previous standard] was that you could build really good resource handles - like vector, or istream, or thread - but they are hard to move around because this is computers and everybody knows that you copy things. In the real world you don’t copy things.

"If I lend you my phone, I don’t make a copy of my phone, I move it. We can do the same in C++ now. If I make a 10,000 by 10,000 matrix in a function, I can hand it over to you at the cost of two pointer assignments. We are talking picoseconds. That is a huge difference in the way I can write code today.”

Stroustrup does not favour a "dumbing down" of the language. “People always want to simplify the language to do exactly what they want, but to be part of a huge global and multi-industry community the language has to support things you would never do in your field. I see the language as a general purpose tool, and coding standards as specifying what you can do in a specific domain,” he says.

Reducing the cost and complexity of web vulnerability management

Next page: Fuming frustration

More from The Register

next story
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
iOS 8 release: WebGL now runs everywhere. Hurrah for 3D graphics!
HTML 5's pretty neat ... when your browser supports it
'People have forgotten just how late the first iPhone arrived ...'
Plus: 'Google's IDEALISM is an injudicious justification for inappropriate biz practices'
Mathematica hits the Web
Wolfram embraces the cloud, promies private cloud cut of its number-cruncher
Mozilla shutters Labs, tells nobody it's been dead for five months
Staffer's blog reveals all as projects languish on GitHub
SUSE Linux owner Attachmate gobbled by Micro Focus for $2.3bn
Merger will lead to mainframe and COBOL powerhouse
iOS 8 Healthkit gets a bug SO Apple KILLS it. That's real healthcare!
Not fit for purpose on day of launch, says Cupertino
Not appy with your Chromebook? Well now it can run Android apps
Google offers beta of tricky OS-inside-OS tech
prev story

Whitepapers

Secure remote control for conventional and virtual desktops
Balancing user privacy and privileged access, in accordance with compliance frameworks and legislation. Evaluating any potential remote control choice.
WIN a very cool portable ZX Spectrum
Win a one-off portable Spectrum built by legendary hardware hacker Ben Heck
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Beginner's guide to SSL certificates
De-mystify the technology involved and give you the information you need to make the best decision when considering your online security options.