VoidParam Puzzle—Alex Marmer

Alex Marmer has openend a puzzle.

VoidParam Puzzle 

From the article:

How to handle 'void' parameter passed in a macro. He provides a solution as well.

In case that you have other or better solutions, don't hesitate to use the comment option on this site.

Quick Q: If nullptr_t isn’t a keyword, why are char16_t and char32_t?

Quick A: To allow overloading with the underlying types of uint_least16_t and uint_least32_t

Recently on SO:

If nullptr_t isn't a keyword, why are char16_t and char32_t?

The proposal itself explains why: to allow overloading with the underlying types of uint_least16_t and uint_least32_t. If they were typedefed this wouldn't be possible.

Define char16_t to be a distinct new type, that has the same size and representation as uint_least16_t. Likewise, define char32_t to be a distinct new type, that has the same size and representation as uint_least32_t.

[N1040 defined char16_t and char32_t as typedefs to uint_least16_t and uint_least32_t, which make overloading on these characters impossible.]

As for why they aren't in the std namespace, this is for compatibility with the original C proposal. C++ prohibits the C definitions from appearing in its own version of <cuchar>

[c.strings] / 3

The headers shall not define the types char16_t, char32_t, and wchar_t (2.11).
The types then would need to be global typedefs, which carries its own set of issues such as
typedef decltype(u'q') char16_t;

namespace foo {
  typedef int char16_t;
}

The reason for std::nullptr_t not being a keyword can be found in the question you linked

We do not expect to see much direct use of nullptr_t in real programs.
making nullptr_t the real exception here.

 

CppCon 2015 Beyond Sanitizers…—Kostya Serebryany

Have you registered for CppCon 2016 in September? Don’t delay – Early Bird 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:

Beyond Sanitizers...

by Kostya Serebryany

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

At CppCon’2014 we presented the Sanitizers, a family of dynamic testing tools for C++. These tools allow you to find many stability and security bugs in C++ code, but they are only as good as your tests are. In this talk we will show how to improve your tests with guided fuzzing and how to protect your applications in production even if some bugs were not found. Fuzzing, or fuzz testing, is a surprisingly effective technique that allows you to discover new interesting test inputs. Coverage-guided fuzzing uses coverage-like code instrumentation to make fuzzing orders of magnitude more efficient. Taint-guided fuzzing goes even further by using taint tracking techniques. The next line of defense may be incorporated directly into production: the Control Flow Integrity instrumentation allows you to protect your program from corrupted function pointers (including pointers to virtual tables) and separating stack variables from the call stack protects from corrupted return addresses -- both with near-zero overhead. We will concentrate on particular tools implemented in the opensource LLVM toolchain (libFuzzer, DataFlowSanitizer, -fsanitize=cfi,safe_stack), but will also discuss several alternatives.

C++ for Games: Performance, Allocations and Data Locality—Sergey Ignatchenko

BB_part094_BookChapter013a_v1-640x427.pngWell-illustrated, and well-illustrated, gems:

C++ for Games: Performance, Allocations and Data Locality

by Sergey Ignatchenko

From the draft chapter:

One further thing to keep in mind with regards to 90-10 (or 70-30) rule is that even if only performance of 10% of the code matters, the rest of the code can still affect performance of critical 10% in a Pretty Bad Way :-( ...

ignatchenko-1.PNG

C++ Performance: Common Wisdoms and Common “Wisdoms”—Sergey Ignatchenko

Sergey is writing a book and making draft chapters available for review. Here are sBB_part095_BookChapter013b_v1-640x427.pngSome tried-and-true, well-illustrated and entertaining tips:

C++ Performance: Common Wisdoms and Common "Wisdoms"

by Sergey Ignatchenko

From the draft chapter intro:

The opposite of a fact is falsehood, but the opposite of one profound truth may very well be another profound truth. — Niels Bohr

There are quite a few common wisdoms when it comes to C++ and games. As it always the case when facing a bunch of common wisdoms, some of them have their merits, some are obsolete-beyond-belief, and some are just taken from a very different context and are not really applicable. Let’s take a look at the most popular ones...

C++ Today—Bjarne Stroustrup

An interesting video to watch!

C++ Today

by Bjarne Stroustrup

Summary of the video:

During a short visit to College on 13 May 2016, Bjarne gave a talk describing what C++ is today (May 2016, C++14) and how it can be used well. He will focus on ISO standard C++ and the way it is developing.

 

May update for the C/C++ extension in Visual Studio Code—Ankit Asthana

News from Visual Studio:

May update for the C/C++ extension in Visual Studio Code

by Ankit Asthana

From the article:

We would like to thank all of you who have tried out the C/C++ extension in Visual Studio Code and have already provided
rich feedback on your experiences and filed issues and requests with us. We are working hard on incorporating your feedback
into the product. Continuing with our effort to make Visual Studio Code as the editor tool of choice for C++ developers with
this update of the C/C++ extension, we are introducing the following features:

• Code formatting with clang-format
• Fuzzy Auto-Complete for C/C++ code
• Debugging on Windows for Cygwin/MinGW applications
• Console application debugging with GDB on the Mac

Now let’s dive into each one of these in more detail...

CppCon 2015 Lambdas from First Principles: A Whirlwind Tour of C++—Arthur O’Dwyer

Have you registered for CppCon 2016 in September? Don’t delay – Early Bird 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:

Lambdas from First Principles: A Whirlwind Tour of C++

by Arthur O'Dwyer

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Lambdas (even those mysterious generic lambdas) are just syntactic sugar atop constructs that are perfectly understandable when approached from the right direction.

We'll start with the implementation of C-style functions, then move to overloading, function templates, non-static member functions, C++11 lambdas, and then demystify C++14 generic ("auto") lambdas. Finally, we'll detour into the implementations of std::function and std::bind to show how they're different from lambdas.

doctest—the lightest feature rich C++ single header testing framework version 1.0.0 released!

The lightest feature rich C++ single header testing framework for unit tests and TDD

doctest 1.0.0 released!

From the release:

The doctest library is inspired by the unittest {} functionality of the D programming language and Python's docstrings - tests can be considered a form of documentation and should be able to reside near the production code which they test.

It is modeled after Catch which is currently the most popular and easy to use alternative for testing in C++