Overload 120 is now available

overload-120.PNGOverload 120 is now available. It contains the following C++-related articles, and more:


Overload 120

Enforcing the Rule of Zero

Juan Alday considers how the new standards have affected a common rule.

Search with CppCheck

Martin Moene tries a more powerful code search tool.

Size Matters


Sergey Ignatchenko and Dmytro Ivanchykhin compare 32-bit and 64-bit programs.

Windows 64-bit Calling Conventions

Roger Orr sees how the stack organisation has changed.

Are contiguous C++ arrays really faster than Java/C# ArrayLists?—StackOverflow

When you see anyone claim performance parity between <other language> and C++, one of the first things to look for is whether the C++ version of their test code is correctly using arrays and traversing them in order. If the test code is just doing equivalent pointer-chasing in both languages, the performance comparison is largely meaningless because the program is probably memory-bound and not properly written to use C++'s default container (vector).

Note: The question below has been modified since originally posted and now shows more reasonable numbers that demonstrate contiguous arrays are indeed faster. The comments are still enlightening to read, however.

Today on SO:

Unable to reproduce: C++ Vector performance advantages over C# List performance

At Microsoft's BUILD conference Herb Sutter explained that C++ has "Real Arrays" and C#/Java languages do not have the same or sort of.

I was sold on that. You can watch the full talk here http://channel9.msdn.com/Events/Build/2014/2-661

Here is a quick snapshot of the slide where he described this. http://i.stack.imgur.com/DQaiF.png

But I wanted to see how much difference will I make.

So I wrote very naive programs for testing, [...] Here are the results on my dell laptop with Core i7 processor:

count       C# (List<string>)   C# (ArrayList)     C++  
1000           24 ms              21 ms             7 ms      
10000         214 ms             213 ms            64 ms    
100000  2 sec 123 ms       2 sec 125 ms           678 ms

C++ and Beyond Road Show 2014—September 29 - October 1, Stuttgart, Germany

Today on the C++ and Beyond blog, Scott Meyers announced that registration is now open for a C&B event in Germany this fall, largely repeating the C&B December 2013 material for the benefit of those who were not able to attend the sold-out event in December.

C&B 2014: September 29 - October 1 in Stuttgart!

with Scott Meyers, Herb Sutter, Andrei Alexandrescu

Maritim Hotel, Stuttgart, Germany
September 29 - October 1, 2014

Note: The web page for the event is in German, but the seminar itself will be given in English.

From the announcement:

You can think of this event as the C&B Road Show, because the organization is a little different from how we’ve done things in the past: Most of the talks will be updated versions of the presentations we gave at C&B 2013. (See the schedule here.) If you were unable to attend C&B this past December, this is your chance to see what you missed. ... [See the] web page for C&B 2014 for all the details of this event.

This will be the only C&B in 2014, so we hope to see you in Stuttgart at the end of September for the first-ever C&B in Europe!

Native Code Performance on Modern CPUs: A Changing Landscape—Eric Brumer

eric-brumer-build-2014.PNGThis C++ optimization talk is one of the highest-rated talks from last week's //build/ conference, and deservedly so.

Be prepared for deep content from a compiler optimizer architect, and quite a bit of subtle dry humor.

Native Code Performance on Modern CPUs: A Changing Landscape

by Eric Brumer
Compiler developer, Visual C++ team

Modern CPUs are fast. Really fast. New instructions, wider vector registers, and more powerful CPUs promise faster code. But reasoning about performance is not as it seems on the surface. This talk will dive deep into how advancements in the latest chips force some rethinking of native code performance, from the point of view of a compiler developer. The performance landscape is changing. Come see what that means.

Modern C++: What You Need to Know—Herb Sutter

A recording of yesterday's //build/ talk by Herb Sutter is now available on Channel 9:

Modern C++: What You Need to Know

by Herb Sutter

This talk will give an update on recent progress and near-future directions for C++, both at Microsoft and across the industry. This is a great introduction to the current state of the language, including a glimpse into the future of general purpose, performance-intensive, power-friendly, powerful native programming.

From the advance description on Herb's blog:

I was asked to give a "foundational talk" about C++, and I decided that meant I should focus on addressing two questions that I get a lot these days:

  • FAQ #1 (1-2 slides): When should I use C++ compared to another language -- on all platforms in general, and on Microsoft platforms in particular?
  • FAQ #2 (lots of slides): What should I know about C++ if I’m a {Java|C#|JavaScript|Python|...} developer?

Even if you're a seasoned C++ developer, there are some nuggets and data points in the middle of the talk that I think you will find useful in your own work...

GoingNative no longer a standalone conference, being rolled into CppCon

cppcon-155.PNGThe fall C++ conference calendar is consolidating around the new CppCon.

Yesterday afternoon, the organizers of the popular GoingNative C++ conference announced that they will not organize a GoingNative 2014, in favor of supporting CppCon instead as "'the' C++ conference" and the natural successor to GoingNative.

From the announcement:

With CppCon, there's no longer a need to put on a separate GoingNative -- CppCon is just better in every way.

The Call for Submissions is still open, so we don't know the final session list yet. However, topics that are expected to be covered in CppCon sessions include some you'll likely anticipate, as well as others you'll be surprised and delighted to see covered by experts in their fields:

  • C++11 and C++14, of course
  • C++ libraries and frameworks
  • Parallelism and multiprocessing, including coverage of the Concurrency TS, Parallelism TS, and other C++ libraries and tools for parallel computing
  • Concepts and generic programming
  • Functional programming
  • High-performance and low-latency computing
  • Real-world application experience reports
  • Tools and processes for C++ development
  • Using C++ in mobile applications, embedded devices, and Internet of Things
  • Industry-specific C++: gaming, trading, scientific, robotics, ...
  • And more...

If you liked GoingNative, you will love CppCon [... with] 150+ talk sessions expected -- plus more than just regular talks, including "unconference time" with lightning talks, birds-of-a-feather sessions, evening gatherings, and more.

Reaction on the CppCon site.

Quick Q: Why doesn’t my C++ program compile under Windows 7 French?—StackOverflow

Quick A: It's a language conformance issue.

Today on StackOverflow:

Why can't my program compile under Windows 7 in French?

I'm running Windows 7 French and I'm trying to compile this really basic program, but Visual Studio is being stubborn and refuses to comply. I also tried compiling it with both GCC 4.7 and Clang trunk on Coliru and I get more or less the same errors (output is below the code), though I think Coliru runs on an English OS so I wouldn't expect it to work anyway.

What am I doing wrong? And how can I fix it?