Articles & Books

C++11/14 Idioms I Use Every Day -- Paul Cechner

Start your Monday the right way by sending this to three of your friends who are new to (modern) C++:

C++11/14 Idioms I Use Every Day

by Paul Cechner

From the article:

Most attention on the new C++ has focused on the changes that provide functionality and performance that was previously not possible, both library enhancements (chrono, regex, smart pointers, and stuff to help with lambdas for example) and core language enhancements (perfect forwarding, variadic templates, the new memory model and threading capabilities, initialiser lists and the like). This functionality will impact us all in helping to write more correct code and efficient libraries, but often will only be relevant in certain parts of our code.

But the first thing that struck me when I started using C++11 was the smaller features that I could take advantage of every time I put my fingers to the keyboard. These are the things that make code more concise and simple and allow me to present my intentions more clearly. ...

Stroustrup: Why the 35-year-old C++ still dominates 'real' dev -- Paul Krill, Infoworld

infoworld.PNGToday in Infoworld:

Stroustrup: Why the 35-year-old C++ still dominates 'real' dev

C++ inventor details the language's latest changes and assesses the strengths and weaknesses of its competitors

by Paul Krill, Infoworld

From the interview:

Bjarne Stroustrup designed the C++ language in 1979, and the general-purpose language for systems programming has become a mainstay for developers everywhere, despite competition from Java, JavaScript, Python, Go, and Apple's newly unveiled Swift.

Now a technologist at Morgan Stanley and a professor at both Columbia University and Texas A&M University, Stroustrup spoke with InfoWorld Editor at Large Paul Krill about C++'s role today and about other happenings in software development, including Google's Go and Apple's Swift languages. ...

Quick Q: Does make_shared avoid an extra allocation for the reference counts? -- StackOverflow

A: Yes, make_shared is your friend!

Recently on SO:

What happens when using make_shared

I'm interested if these two lines of code are the same:

shared_ptr<int> sp(new int(1)); // double allocation?
shared_ptr<int> sp(make_shared<int>(1)); // just one allocation?

If this is true could someone please explain why is it only one allocation in the second line?

Overload 122 is available

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

 

Overload 122

Musings on Python -- By a C++ Developer

Python and C++ are very different languages. Sergey Ignatchenko walks through things in Python that can confuse a C++ programmer

Activatable Object

Using locks will slow down threaded code. Len Holgate demonstrates how an Activatable Object can reduce the time spent blocked.

HTTP and HTTPS in Qt

How to handle HTTP and HTTPs requests in Qt

HTTP and HTTPs in Qt

by Jens Weller

From the article:

Last week I started to work on an old project again: My own feed reader. I found the code 2 weeks a go on an old USB Stick, and decided to refactor it into a useful state. This involved dealing with HTTP via QNetworkAccessManager.

C++ User Group Meetings in August

Again, the overview about the upcoming user group meetings for the new month. As it is August, there are not as much meetings due to summer.

C++ User Group Meetings in August 2014

by Jens Weller

From the article:

6.8. C++ UG Austin - Pragmatic Type Erasure
13.8 C++ UG Bay area/San Francisco
14.8 C++ UG Dresden - Compile Time Sort"
14.8 C++ UG NRW/Aachen - Various talks
19.8 C++ UG Berlin - Experience with C++11 in ArangoDB
20.8 C++ UG NRW/Düsseldorf - Wartungtechniken
28.8 C++ UG Amsterdam - Event Driven Design in C++11

AST matchers and Clang refactoring tools -- Eli Bendersky

You can do some great things when you have a reusable open-source C++ parser:

AST matchers and Clang refactoring tools

by Eli Bendersky

From the article:

Clang tooling sees lots of interest and development focus in the past few years. At last, we have a convenient, accurate, open-source and well supported framework for programmatically analyzing and refactoring C++ code; I find this very exciting.

A great outcome of this rapid pace of development is that new APIs and tools spring up all the time. For example, some time ago the Clang tooling developers figured out folks doing AST traversals have to write a lot of repetitive code to find interesting AST nodes, so they came up with a great new API called AST matchers, which I want to discuss here...

Quick Q: Why doesn't std::sort accept its comparator by reference? -- StackOverflow

Quick A: By design, because function objects are expected to be nonstateful values.

Recently on SO:

Why doesn't std::sort accept comparator by reference?

The standard on std::reference_wrapper explains that std::sort now accepts std::reference_wrapper, allowing one to pass a comparator by reference.

Is there a reason std::sort didn't accept the comparator by reference in the first place?

A Clang edition of the C++11/14 Rocks book is now available

Korban's C++11/14 feature overview book now has a Clang edition, in addition to VS2013 and GCC:

Clang Edition of the C++11/14 Rocks Book

by Alex Korban

From the announcement:

Do you use Clang to compile C++? Would you like to know all about the C++11 and C++14 language features it supports?

You can read about them in the new edition of my C++11/14 Rocks book tailored to Clang.

...

For those who have the GCC edition of the book: you’ll already be familiar with all the C++11 content as GCC also has full C++11 support. However, the Clang edition has full C++14 coverage instead of an overview.