Halloween Horror Code Stories -- Jonathan Boccara
Jonathan stepped over horrible code. Be aware and prepared to handle it:

by Jonathan Boccara
Be prepared for
Ten Halloween Horror Code Stories That Will Freak You Out!
March 23-28, London, UK
By Felix Petriconi | Oct 30, 2017 03:00 PM | Tags: None
Jonathan stepped over horrible code. Be aware and prepared to handle it:

by Jonathan Boccara
Be prepared for
Ten Halloween Horror Code Stories That Will Freak You Out!
By Adrien Hamelin | Oct 24, 2017 12:46 PM | Tags: intermediate c++11
Quick A: Yes, but with unspecified behavior in case of exception thrown.
Recently on SO:
Using an object without copy and without a noexcept move constructor in a vector. What actually breaks and how can I confirm it?
A vector reallocation attempts to offer an exception guarantee, i.e. an attempt to preserve the original state if an exception is thrown during the reallocation operation. There are three scenarios:
- The element type is nothrow_move_constructible: Reallocation can move elements which won't cause an exception. This is the efficient case.
- The element type is CopyInsertable: if the type fails to be nothrow_move_constructible, this is sufficient to provide the strong guarantee, though copies are made during reallocation. This was the old C++03 default behaviour and is the less efficient fall-back.
- The element type is neither CopyInsertable nor nothrow_move_constructible. As long as it is still move-constructible, like in your example, vector reallocation is possible, but does not provide any exception guarantees (e.g. you might lose elements if a move construction throws).
The normative wording that says this is spread out across the various reallocating functions. For example, [vector.modifiers]/push_back says:
If an exception is thrown while inserting a single element at the end and T is CopyInsertable or is_nothrow_move_constructible_v<T> is true, there are no effects. Otherwise, if an exception is thrown by the move constructor of a non-CopyInsertable T, the effects are unspecified.I don't know what the authors of the posts you cite had in mind, though I can imagine that they are implicitly assuming that you want the strong exception guarantee, and so they'd like to steer you into cases (1) or (2).
By Adrien Hamelin | Oct 23, 2017 01:01 PM | Tags: intermediate
Do you know that keyword?
Mutable
by Arne Mertz
From the article:
The
mutablekeyword seems to be one of the less known corners of C++. Yet it can be very useful, or even unavoidable if you want to write const-correct code or lambdas that change their state...
By Adrien Hamelin | Oct 23, 2017 12:59 PM | Tags: intermediate
Quick A: To hide implementation details
Recently on SO:
Why would one use nested classes in C++?
Nested classes are cool for hiding implementation details
List:
class List { public: List(): head(NULL), tail(NULL) {} private: class Node { public: int data; Node* next; Node* prev; }; private: Node* head; Node* tail; };Here I don't want to expose Node as other people may decide to use the class and that would hinder me from updating my class as anything exposed is part of the public API and must be maintained forever. By making the class private, I not only hide the implementation I am also saying this is mine and I may change it at any time so you can not use it.
Look at std::list or std::map they all contain hidden classes (or do they?). The point is they may or may not, but because the implementation is private and hidden the builders of the STL were able to update the code without affecting how you used the code, or leaving a lot of old baggage laying around the STL because they need to maintain backwards compatibility with some fool who decided they wanted to use the Node class that was hidden inside <list>.
By Adrien Hamelin | Oct 23, 2017 12:51 PM | Tags: intermediate c++11
A follow up on error codes.
error codes — some clarifications
by Andrzej Krzemieński
From the article:
In this post I would like to discuss two issues brought up by the readers regarding previous posts on using <system_error>:
- Storing 0 in error codes, and using non-0 success values.
- Concerns about using globals.
By Felix Petriconi | Oct 17, 2017 11:54 PM | Tags: None
ACCU’s Overload journal of October 2017 is out. It contains the following C++ related articles.
Overload 141
From the index:
'Speedy Gonzales' Serializing (Re)Actors via Allocators
Polymorphism in C++ - A Type Compatibility View
Open Source - And Still Deceiving Programmers
C++11 (and Beyond) Exception Support
By bfilipek | Oct 17, 2017 01:18 AM | Tags: None

Summary of the articles about C++17, with additional bonus
C++17 in detail: Summary & Bonus
by Bartlomiej Filipek
From the article:
It was a great jurney, 8 articles where we covered most of the new stuff in C++17. As a bonus I merged all of the content into one PDF. That way it might be easier to read. Have a look.
By Adrien Hamelin | Oct 13, 2017 12:50 PM | Tags: community c++17
A reminder of what C++17 bring:
C++17
by Egor Bredikhin
From the article:
C++ language is constantly evolving, and for us, as for developers of a static analyzer, it is important to track all its changes, in order to support all new features of the language. In this review article, I would like to share with the reader the most interesting innovations introduced in C++17, and demonstrate them with examples.
By Andrey Karpov | Oct 12, 2017 11:35 AM | Tags: c++17
C++ language is constantly evolving, and for us, as for developers of a static analyzer, it is important to track all its changes, in order to support all new features of the language.
Most interesting innovations in C++17
by Egor Bredikhin
From the article:
Fold expressions, template<auto>, constexpr if, constexpr lambdas, *this capture in lambda expressions, inline variables, structured bindings, __has_include, std: byte type and so on.
By Adrien Hamelin | Oct 11, 2017 11:50 AM | Tags: community
And another trip report:
Trip report: the JetBrains C++ team at CppCon 2017
by Anastasia Kazakova
From the article:
Our C++ team just returned from the main event in the C++ world, the CppCon 2017 conference in Bellevue, Washington. While our impression of this fantastic event is still fresh, we’d like to share our thoughts and findings here with you.