intermediate

Quick Q: Why doesn’t c++ have a specified order for evaluating function arguments?

Quick A: In order to get the best performance.

recently on SO:

Why doesn’t c++ have a specified order for evaluating function arguments?

C++ leaves as much as practical up to the implementation of the compiler, especially where optimization opportunities might occur. Before fixing something like this, existing compiler writers are consulted to see if there is a cost.

Some order of evaluation guarantees surrounding overloaded operators and complete-argument rules where added in C++17. But it remains that which argument goes first is left unspecified. In C++17, it is now specified that the expression giving what to call (the code on the left of the ( of the function call) goes before the arguments, and whichever argument is evaluated first is evaluated fully before the next one is started, and in the case of an object method the value of the object is evaluated before the arguments to the method are. (There may be some minor errors in this description: ask a narrow question about it for a more vetted answer).

These where vetted and determined to not cause significant prolems for existing compilers. Reordering of arguments was considered, and discarded, presumably for good reasons. Or even poor reasons, like existing compilers have a default order and it could break (possibly non-compliant) code on that compiler to force them all to do it in one global order.

In short, C++ leaves lots of freedom to compiler writers. This has let compiler writers find optimization opportunities in strange crannies. The kind of optimizations available today are way beyond what the original writers of C++, let alone C++, may have suspected where practical or be considered reasonable.

CppCon 2015 Test Driven C++ with Catch–Phil Nash

Have you registered for CppCon 2016 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2015 for you to enjoy. Here is today’s feature:

Test Driven C++ with Catch

by Phil Nash

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

C++ has been notorious for being a second class citizen when it comes to test frameworks. There are plenty of them but they tend to be fiddly to set-up and ceremonious to use. Many of them attempt to follow the xUnit template without respect for the language environment they are written for. Catch is an attempt to cut through all of that. It is simple to get and simple to use - being distributed in a single header file - yet is powerful and flexible. Catch includes a number of innovations that make testing in C++ more natural - and fun - than ever before. This presentation introduces you to the unique approach that Catch brings to unit and integration testing - and how to use Catch to drive your design with TDD or BDD.

Const Correctness–Arne Mertz

Do you use const well?

Const Correctness

by Arne Mertz

From the article:

Writing const correct code is about more than using const in a few places and letting the compiler figure out if it makes sense.

There are two components about using the keyword const in C++ code: A syntactic component and a semantic component…

Move safety - know what can be done in the moved-from state–Jonathan Müller

What state is an object after move?

Move safety - know what can be done in the moved-from state

by Jonathan Müller

From the article:

C++ programmers have this notion of exception safety. It is a very useful concept. With it one can easily describe the post-conditions of a function if it throws.

There is another situation where you need to easily describe some post-conditions: when talking about the state of an object after a move operation, i.e. after a move constructor or move assignment operator. I thus want to introduce vocabulary for those post-conditions of the right-hand argument similar to the exception safety of a function: The move safety, if you will.

The exception safety describes the post-conditions of a function if the function throws an exception. Similarly, the move safety describes the post-conditions of the object after a move operation. It thus gives information about what can be done safely with a moved-from object…

CppCon 2015 Cross-Platform Mobile App Development with Visual C++–Ankit Asthana & Marc Gregoire

Have you registered for CppCon 2016 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2015 for you to enjoy. Here is today’s feature:

Cross-Platform Mobile App Development with Visual C++

by Ankit Asthana & Marc Gregoire

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Visual C++ 2015 supports the development of apps for the Windows platform as well as for Android and iOS. A single code base, possibly with a thin platform-specific UI layer, can be compiled to run on Windows, Android, and iOS. The resulting binary can be published to a device and debugged, all from within Visual C++ 2015. This presentation introduces you to such cross-platform mobile app development, including debugging and emulation, and includes a number of demos.

CppCon 2015 C++: How I learned to stop worrying and love metaprogramming–Edouard Alligand

Have you registered for CppCon 2016 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2015 for you to enjoy. Here is today’s feature:

C++: How I learned to stop worrying and love metaprogramming

by Edouard Alligand

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Horrible software engineering technique conceived in the forge of Hell or the Only True Way of doing C++ in 2015, template metaprogramming and its cohort of companion techniques are sure to create animation in a group of programmers.

What if we were to tell you that an actual software product, actually sold to real customers and in production for now several years has been built on it? What if we were to tell you that a lot of advanced template techniques helped us to build a better software faster?

This talk is all about real life examples of template metaprogramming, why they are useful and when and how you could use them in your own projects.

An update on the Meeting C++ Workshop Day

I finally can announce that the workshops will end with talks by James McNellis and Michael Caisse:

An Update on the workshop day

by Jens Weller

From the article:

Michael Caisse - boost.fusion: power to the tuples

    Tuples provide heterogeneous, compile-time containers; however, they can be difficult to use at run-time. Boost.Fusion brings together compile-time and run-time semantics to produce the STL of the meta-programming world. It is the machinery behind several Boost libraries and is a common element in many of the solutions provided by Ciere Consulting.


James McNellis - Practical C++ Coroutines

    One of the most interesting new features being proposed for C++ standardization is coroutines, formerly known as “resumable functions”. C++ coroutines are designed to be highly scalable, highly efficient (no overhead), and highly extensible, while still interacting seamlessly with the rest of the C++ language.

Meeting C++ 2016: closing keynote & full schedule

With the announcement of the closing keynote the full schedule for Meeting C++ 2016 stands!

Closing keynote & full schedule of Meeting C++ 2016

by Jens Weller

From the article:

Since mid of June the program of the 5th Meeting C++ conference was taking shape. With the selection of the talks it was also clear in which tracks they go, so that the schedule it self was almost ready, except a last detail: the closing keynote.

The closing keynote will be held by Louis Dionne on “C++ metaprogramming: evolution and future directions”.

CppCon 2015 Functional Design Explained–David Sankel

Have you registered for CppCon 2016 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2015 for you to enjoy. Here is today’s feature:

Functional Design Explained

by David Sankel

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

An oft-cited benefit of learning a functional language is that it changes one’s approach to solving problems for the better. The functional approach has such a strict emphasis on simplistic and highly composable solutions that an otherwise varied landscape of solution possibilities narrows down to only a few novel options.

This talk introduces functional design and showcases its application to several real-world problems. It will briefly cover denotational semantics and several math-based programming abstractions. Finally, the talk will conclude with a comparison of functional solutions to the results more traditional design methodologies.

No prior knowledge of functional programming or functional programming languages is required for this talk. All the examples make use of the C++ programming language.