From the archives: “C++: as close as possible to C—but no closer”—A. Koenig and B. Stroustrup

n0007.PNGFor your Friday reading pleasure, we recently came across one of the very earliest C++ standardization papers written, with number N0007 (or call it "007"):

C++: as close as possible to C -- but no closer

by Andrew Koenig and Bjarne Stroustrup

It's interesting too see how much C++ has stayed true to its root design. And the thesis and contents of this paper are both remarkably current, and to be considered by those who would attempt to C-ify C++, or C++-ify C.

From the paper:

ANSI C and the C subset of C++ serve subtly different purposes. ...

The purpose of this note is to summarize the remaining differences between the draft ANSI C standard and C++, explain their motivation, and point out cases where these differences are less important than they might appear at first.

Writing min function, part 4: Const-Correctness—Fernando Pelliccioni

Writing min function, part 4: Const-Correctness

by Fernando Pelliccioni

From the Article:

This is the fourth article of the series called “Writing min function”.

I still have to solve two mistakes made in the code of the previous posts. One of them is C++ specific, and the other it is a mistake that could be made in any programming language.


Italian C++ Community Meetup—November 8, Bologna, Italy

it-meetup-2014-11.PNGThe next meetup of ++it (, the Italian C++ Community) will be in Bologna, Italy, on November 8th.


  • 1 interactive session.
  • 2x60' talks.
  • 2x30' lightning talks.
  • 1x45' Q/A panel.
  • Networking breaks and lunch.

Special speaker

  • Bartosz Milewski!

More details (in Italian) and registration (free) here.

Extension methods in C++—Marius Bancila

Recently on Codexpert, an enthusiastic and very readable reaction to two fresh standards proposals that will be considered two weeks from now at the ISO C++ meeting in Urbana-Champaign, Illinois, USA:

Extension methods in C++

by Marius Bancila

From the article:

... if x.f(y) and f(x,y) were equivalent it would be very easy to write the above code like this:

auto v = std::vector<int> {1,2,3,4,5,6,7,8,9};

auto s = v.where([](int e){return e % 2 == 0; })
          .select([](int e){return e*e; })

Isn’t that beautiful? I think it is.


The N4174 paper is rather an exploration of possibilities for uniform calling syntax than a very formal proposal. There are various aspects that have to be carefully considered especially when considering how to treat f(x, y). The N4165 paper makes a good case of the uniform calling syntax, explains the benefits better and argues against treating f(x) equivalent to x.f(). You should go ahead and read the two papers for detailed information. However, I sincerely hope that one day this will be accepted and become a core feature of the C++ language.

Quick Q: Does unordered_map<string,MyClass>::erase() destroy my MyClass objects?—SO

Quick A: No, but unordered_map<string, unique_ptr<MyClass>>::erase and unordered_map<string, shared_ptr<MyClass>>::erase do.

Today on SO:

std::unordered_map<std::String, myClass*> -- does std::unordered_map::erase() call myClass' DTor?

Assume I have some unordered_map of pointers to class instances, would erasing an object from that map also delete the instance?

(rewording the question:) If I wanted to delete that instance, which version would be right?

if(it != map.end())
    delete it->second;

or simply

if(it != map.end())


Quick Q: Is there an alternative to PC-Lint that supports C++14?—StackOverflow

It's not often we run a link to a SO article in the Product section, but this is a useful product question.

Alternative for PC-Lint supporting C++14 (Visual Studio 2013)

I am using PC-Lint for quite some time with very good results.

The last year however, I noticed that PC-Lint cannot keep up with the new C++ standards. E.g. range-based for-loops, variadic templates, make_unique, ... which are all constructions supported by Visual Studio 2013, aren't recognized by PC-Lint.

The result is that my code is now filled with lint-comments to disable checking on blocks of code using these constructions. This means:

  • less readable code
  • I'm almost spending more time updating my lint-comments that actually writing code

Is there an alternative (free or commercial) for PC-Lint on Windows that can keep up with the recent C++ standards?

A pair of articles on advanced template mechanics—Eli Bendersky and Eric Niebler

If you're a very advanced C++ developer with an appetite for template mechanics, these two articles that were posted in the past 24 hours may interest you.

Note: The vast majority of C++ developers don't need to know this, but very advanced developers will find the material and the techniques interesting.

SFINAE and enable_if

by Eli Bendersky

Customization Point Design in C++11 and Beyond

by Eric Niebler

How Microsoft is taking on the cross-platform challenge with Office—Mary Jo Foley

zaika-office.PNGModern C++, modern apps:

How Microsoft is taking on the cross-platform challenge with Office

by Mary Jo Foley

Summary: Microsoft's Office team has a new approach designed to allow it to share more of Office's code across not just Windows, but also Android, iOS and the Web.

Note: This is a 50-minute version of the same talk given at CppCon in two one-hour sessions. After presenting this at CppCon, Igor was invited to present the information also at Facebook's @Scale.

See also Dropbox's CppCon talk about how Dropbox uses a similar architecture, and moved to C++ to enable a single cross-platform source base after initially having written separate apps in Java for Android and Objective-C for iOS.

From the article:

Zaika talked about Microsoft's Office cross-platform architecture strategy at the recent Facebook @Scale conference. ... In his 50-minute session, Zaika detailed how Microsoft is building Office across Windows, Apple, Android and the Web by using C++. ...

The goal is to maintain a shared core of intellectual property — the guts of Office — all written in C++ and keep that shared core as large as possible. By doing this, risks of document corruption are reduced. On top of that core, there is a set of native UX application programming interfaces. ...

The goal of "write once, run anywhere" which technologies like Java, Flash and HTML5 were designed to try to solve by pushing the level of abstraction as low as possible or making application programming interfaces (APIs) very broad sounded good, Zaika said, but ended up creating impedance mismatch. Compatibility and interoperability problems, among others, arose. "Either you blew up, or the OS (operating system) blew up," Zaika said. ...

With a common C++ core, a thin native UX layer and evolving PALs, Microsoft is building its Office apps so they work on different OSes with fairly little tweaking required. Zaika cited PowerPoint as an example, noting that only four percent of its tens of millions of lines are unique to the WinRT/Universal version of Office (the touch-first Office release some of us have been calling "Gemini"). If the XAML code is excluded, the amount of shared code is 98.6 percent he said. The PowerPoint for Android code base includes 95 percent shared code, Zaika said.

Meeting C++ is sold out!

Last week the last ticket for Meeting C++ has been sold:

Meeting C++ is sold out for now

by Jens Weller

from the Article:

Ticket sales have been strong all summer long, and those who have yet not got their ticket will have to wait, maybe even for next year. There might be a second batch of tickets, which will not be more then 10-30 tickets released at the beginning of November. But for now, we are at almost 300 Attendees for Meeting C++! This includes the 50 Students, the speakers, the staff and all sold tickets.

A Video Interview with Herb Sutter on C++ Standards—Brian Overland

sutter-overland.PNGAt CppCon last month, InformIT recorded this video interview. It has now been posted: 

A Video Interview with Herb Sutter on C++ Standards

with Brian Overland

From the synopsis:

Herb Sutter ... talks with Brian Overland about how the standards committee evaluates proposals, the importance of being egoless, how to submit a proposal to the standards committee, why the committee decided to update the standard every three years, and the adoption of C++ in cross-platform mobile apps.