C++17: Inline Variables--Marc Gregoire
A handy new feature:
C++17: Inline Variables
by Marc Gregoire
From the article:
Before C++17, if your class had any non-const static data members, you had to allocate memory for them.
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 3-8, Kona, HI, USA
By Adrien Hamelin | Aug 29, 2017 12:43 PM | Tags: intermediate c++17
A handy new feature:
C++17: Inline Variables
by Marc Gregoire
From the article:
Before C++17, if your class had any non-const static data members, you had to allocate memory for them.
By Adrien Hamelin | Aug 28, 2017 01:09 PM | Tags: efficiency c++11
You use threads? You should know this.
Top 20 C++ multithreading mistakes and how to avoid them
by Deb Haldar
From the article:
Threading is one of the most complicated things to get right in programming, especially in C++. I've made a number of mistakes myself over the years. Most of these mistakes were luckily caught in code review and testing ; however, some arcane ones did slip through and make it into production code and we had to patch live systems, which is always expensive.
In this article, I've tried to catalog all the mistakes I know of, with potential solutions. If you know any more pitfalls, or have alternative suggestions for some of the mistakes – please leave a comment below and I'll factor them into the article.
By bfilipek | Aug 23, 2017 10:23 AM | Tags: performance c++17
Let’s see how C++17 can make writing parallel code a bit easier.
C++17 in details: Parallel Algorithms
by Bartlomiej Filipek
From the article:
With C++17 we get a lot of algorithms that can be executed in a parallel/vectorized way. That’s amazing, as it’s a solid abstraction layer. With this making, apps is much easier. A similar thing could be achieved possibly with C++11/14 or third-party APIs, but now it’s all in the standard.
By Adrien Hamelin | Aug 23, 2017 09:19 AM | Tags: intermediate c++17
THe series continue.
C++17 in details: Parallel Algorithms
by Bartlomiej Filipek
From the article:
Writing multithreaded code is hard. You’d like to utilize all of the machine’s processing power, keeping code simple and avoid data races at the same time.
Let’s see how C++17 can make writing parallel code a bit easier.
By Adrien Hamelin | Aug 21, 2017 12:10 PM | Tags: community
ACCU’s Overload journal of June 2017 is out. It contains the following C++ related articles.
From the journal:
Editorial: Gnomes and Misnomers.
What's in a name? Frances Buontempo decides some names are better than others.The Path of the Programmer.
Charles Tolman provides a framework for personal development.A Usable C++ Dialect that is Safe Against Memory Corruption.
Sergey Ignatchenko continues his investigation of allocators for (Re)Actors.Metaclasses: Thoughts on Generative C++.
Herb Sutter shows how metaclasses could simplify C++ with minimal library extension.A C++ Developer Sees Rustlang for the First Time.
Katarzyna Macias provides an introduction to Rust for a C++ developer.Portable Console I/O via iostreams.
Alf Steinbach describes how his library fixes problems streaming non-ASCII characters in Windows.A Functional Alternative to Dependency Injection in C++.
Satprem Pamudurthy showcases a functional alternative to dependency injection in C++.About the C++ Core Guidelines.
Andreas Fertig shows us the C++ core guidelines.Afterwood.
Chris Oldwood reminds us to fix the problem, not to blame.
By Adrien Hamelin | Aug 18, 2017 12:11 PM | Tags: intermediate c++11
Quick Q: Delete its constructor
Recently on SO:
Make C++ fail compilation on specific instantiation of template function
Since foo is a complete specialization, it will always get compiled, and the static assert will always get called.
However, there’s an easier way:
template <> Bar foo<Bar>(Bar val) = delete;This will say that this specific version is deleted, and cannot be called.
By Eric Niebler | Aug 17, 2017 03:56 PM | Tags: intermediate experimental c++20
Eric Niebler shares his thoughts about the interaction of ranges and co-routines in his recent blog post.
Ranges, Coroutines, and React: Early Musings on the Future of Async in C++
by Eric Niebler
From the article:
Another way to look at this is that synchronous ranges are an example of a pull-based interface: the user extracts elements from the range and processes them one at a time. Asynchronous ranges, on the other hand, represent more of a push-based model: things happen when data shows up, whenever that may be. This is akin to the reactive style of programming.
By using ranges and coroutines together, we unify push and pull based idioms into a consistent, functional style of programming. And that’s going to be important, I think.
By Adrien Hamelin | Aug 15, 2017 01:51 PM | Tags: intermediate c++11
The series continues.
Your own error condition
by Andrzej Krzemieński
From the article:
In the previous post we have seen how you can create your own error-code enumeration for representing different reasons for failure in your component, and how you can store them and convey them type erased via std::error_code. In this post we will see how you can inspect an error situation encoded in std::error_code, and how you can build useful queries about error conditions.
By Adrien Hamelin | Aug 14, 2017 02:48 PM | Tags: c++17 basics
C++17 is almost there.
7 Features of C++17 that will simplify your code
by fenbf
From the article:
With each C++ standard, we aim for simpler, cleaner and more expressive way to code. C++17 offers several "big" language features that should make our code nicer. Today, I tried to pick seven things that make your code more compact right off the bat.
By Adrien Hamelin | Aug 10, 2017 01:28 PM | Tags: intermediate c++11
Quick A: Because it is defined at compile time in a special section.
Recently on SO:
A little confused about constexpr functions
If 'x' is declared static, there are no errors. Why?This is because there is always exactly one x in the program. It has an address (somewhere in the .data segment under normal conditions).
Confusingly, both static and extern keywords specify the storage duration as static (they differ in linkage)
How is it possible to get a variable address during the compilation process? Aren't they allocated at run-time?Variables with automatic, dynamic or thread storage durations are allocated at runtime. Static duration variables are allocated by the compiler. (The linker and OS can change the location, but they know how to fix all the references when they do)