C++ Weekly Episode 8: C++ Name Demangling -- Jason Turner
Episode 8 of C++ Weekly.
C++ Name Demangling
by Jason Turner
About the show:
In this episode Jason discusses some of what C++ name mangling is and how to demangle names at runtime.
June 16-21, Sofia, Bulgaria
September 13-19, Aurora, CO, USA
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 16-21, Kona, HI, USA
By Jason Turner | May 2, 2016 08:48 AM | Tags: None
Episode 8 of C++ Weekly.
C++ Name Demangling
by Jason Turner
About the show:
In this episode Jason discusses some of what C++ name mangling is and how to demangle names at runtime.
By bashrc | May 2, 2016 08:17 AM | Tags: basics
Saurabh Singh describes in a brief tutorial on how to correctly implement the comparator function for STL containers and algorithms.
Strict Weak Ordering and STL
by Saurabh Singh
From the article:
If you had ever used a map or set or even std::sort I bet you would have to give a comparator function. (Or an overload to the < (less than) operator).
I will try to give an overview of how certain associative stl containers use this property for ordering the elements.
Almost all stl containers rely on strict weak ordering A strict weak ordering defines the relative position of elements in terms of precedence of one item over other. For eg. if you have a room full of person and you have to form a queue based on their height, a person with "lesser" height will "precede" the person with greater height. For a function to be satisfying strict weak ordering following conditions need to be met.The PDF version of the document is available here.
By Adrien Hamelin | Apr 29, 2016 01:42 PM | Tags: intermediate c++14
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:
Writing Good C++14
by Bjarne Stroustrup
Summary of the talk:
How do we use C++14 to make our code better, rather than just different? How do we do so on a grand scale, rather than just for exceptional programmers? We need guidelines to help us progress from older styles, such as “C with Classes”, C, “pure OO”, etc. We need articulated rules to save us from each having to discover them for ourselves. Ideally, they should be machine-checkable, yet adjustable to serve specific needs.
In this talk, I describe a style of guidelines that can be deployed to help most C++ programmers. There could not be a single complete set of rules for everybody, but we are developing a set of rules for most C++ use. This core can be augmented with rules for specific application domains such as embedded systems and systems with stringent security requirements. The rules are prescriptive rather than merely sets of prohibitions, and about much more than code layout. I describe what the rules currently cover (e.g., interfaces, functions, resource management, and pointers). I describe tools and a few simple classes that can be used to support the guidelines.
The core guidelines and a guideline support library reference implementation will be open source projects freely available on all major platforms (initially, GCC, Clang, and Microsoft).
By robwirving | Apr 29, 2016 08:00 AM | Tags: None
Episode 55 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Elena Sagalaeva from Microsoft's Bing Ads team to discuss Distributed Computing with C++.
CppCast Episode 55: Distributed Computing with Elena Sagalaeva
by Rob Irving and Jason Turner
About the interviewee:
Elena Sagalaeva is a Russian-born professional C++ developer since 2000. She was primarily a game developer working both for various studios and as an indie developer. She grad uated from the industry while being a tech lead at the head of a small dev team.
Elena currently lives in U.S. with her family and works at Microsoft in Bing Ads. Her current interests focus on large scale distributed systems and the development of the C++ language.
She has a popular blog on C++ in Russian and she is the author of the famed C++ Lands map.
By Meeting C++ | Apr 29, 2016 06:10 AM | Tags: tools tooling intermediate c++14 basics
A new blogpost on the release of GCC 6.1:
The highlights and more of GCC 6.1
by Jens Weller
From the article:
In this week GCC 6.1 was released, a new major version of GCC. This new version brings again many new features for C++ to the GNU Compiler Collection. A short overview on these
By Adrien Hamelin | Apr 28, 2016 01:06 PM | Tags: experimental c++14 c++11
juCi++ is a lightweight, platform independent C++-IDE with support for C++11, C++14, and experimental C++17 features depending on libclang version.
juCi++
About:
Current IDEs struggle with C++ support due to the complexity of the programming language. juCI++, however, is designed especially towards libclang with speed and ease of use in mind...
By Adrien Hamelin | Apr 28, 2016 12:57 PM | Tags: intermediate c++11
Quick A: Categories of values that determine what can be done with that value.
Some time ago on SO:
What are rvalues, lvalues, xvalues, glvalues, and prvalues?
What are these new categories of expressions?The FCD (n3092) has an excellent description:I suggest you read the entire section 3.10 Lvalues and rvalues though.— An lvalue (so called, historically, because lvalues could appear on the left-hand side of an assignment expression) designates a function or an object. [ Example: If E is an expression of pointer type, then *E is an lvalue expression referring to the object or function to which E points. As another example, the result of calling a function whose return type is an lvalue reference is an lvalue. —end example ]
— An xvalue (an “eXpiring” value) also refers to an object, usually near the end of its lifetime (so that its resources may be moved, for example). An xvalue is the result of certain kinds of expressions involving rvalue references (8.3.2). [ Example: The result of calling a function whose return type is an rvalue reference is an xvalue. —end example ]
— A glvalue (“generalized” lvalue) is an lvalue or an xvalue.
— An rvalue (so called, historically, because rvalues could appear on the right-hand side of an assignment expressions) is an xvalue, a temporary object (12.2) or subobject thereof, or a value that is not associated with an object.
— A prvalue (“pure” rvalue) is an rvalue that is not an xvalue. [ Example: The result of calling a function whose return type is not a reference is a prvalue. The value of a literal such as 12, 7.3e5, or true is also a prvalue. —end example ]
Every expression belongs to exactly one of the fundamental classifications in this taxonomy: lvalue, xvalue, or prvalue. This property of an expression is called its value category. [ Note: The discussion of each built-in operator in Clause 5 indicates the category of the value it yields and the value categories of the operands it expects. For example, the built-in assignment operators expect that the left operand is an lvalue and that the right operand is a prvalue and yield an lvalue as the result. User-defined operators are functions, and the categories of values they expect and yield are determined by their parameter and return types. —end note
How do these new categories relate to the existing rvalue and lvalue categories?Again:
Are the rvalue and lvalue categories in C++0x the same as they are in C++03?The semantics of rvalues has evolved particularly with the introduction of move semantics.Why are these new categories needed?So that move construction/assignment could be defined and supported.
By Adrien Hamelin | Apr 28, 2016 12:47 PM | Tags: intermediate c++11
Quick A: Yes, a final class cannot have its methods overriden.
Recently on SO:
Does C++ final imply final in all aspects?
To quote the draft C++ standard from here [class.virtual/4]:
If a virtual function f in some class B is marked with the virt-specifier final and in a class D derived from B a function D::f overrides B::f, the program is ill-formed.And here [class/3]:If a class is marked with the class-virt-specifier final and it appears as a base-type-specifier in a base-clause (Clause [class.derived]), the program is ill-formed.So, in answer to the question;
Does a final class implicitly imply its virtual functions to be final as well? Should it? Please clarify.
So, at least not formally. But attempts to violate either rule will be the same result in both cases; the program is ill-formed and so won't compile. A final class means the class cannot be derived from, so as a consequence of this, its virtual methods cannot be overridden.
Should it? Probably not, they are related but they not the same thing. There is also no need formally require the one to imply the other, the effect follows naturally. Any violations have the same result, a failed compile (hopefully with appropriate error messages to distinguish the two).
By Felix Petriconi | Apr 28, 2016 12:05 AM | Tags: community c++14
After slightly more than a year since last major GCC release, the GCC project is proud to announce the new major GCC release, 6.1.
GCC 6.1 Released
by the GCC project
From the article:
GCC 6.1 is a major release containing substantial new functionality not available in GCC 5.x or previous GCC releases.
The C++ frontend now defaults to C++14 standard instead of C++98 it has been defaulting to previously, for compiling older C++ code that might require either explicitly compiling with selected older C++ standards, or might require some code adjustment, see http://gcc.gnu.org/gcc-6/porting_to.html for details. The experimental C++17 support has been enhanced in this release.
This releases features various improvements in the emitted diagnostics, including improved locations, location ranges, suggestions for misspelled identifiers, option names etc., fix-it hints and a couple of new warnings have been added.
The OpenMP 4.5 specification is fully supported in this new release, the compiler can be configured for OpenMP offloading to Intel XeonPhi Knights Landing and AMD HSAIL. The OpenACC 2.0a specification support has been much improved, with offloading to NVidia PTX.
The optimizers have been improved, with improvements appearing in all of intra-procedural optimizations, inter-procedural optimizations, link time optimizations and various target backends.
See https://gcc.gnu.org/gcc-6/changes.html for more information about changes in GCC 6.1.
This release is available from the FTP servers listed here: http://www.gnu.org/order/ftp.html
The release is in gcc/gcc-6.1.0/ subdirectory.
If you encounter difficulties using GCC 6.1, please do not contact me directly. Instead, please visit http://gcc.gnu.org for information about getting help.
Driving a leading free software project such as GNU Compiler Collection would not be possible without support from its many contributors. Not to only mention its developers but especially its regular testers and users which contribute to its high quality. The list of individuals is too large to thank individually!
By Adrien Hamelin | Apr 27, 2016 02:00 PM | Tags: intermediate c++11
Factories also changed with the standard.
Out With The Old, In With The New
by Anthony DaSilva Jr
From the article:
In “old” C++, object factories had no choice but to return unsafe naked pointers to users. In “new” C++, factories can return safe smart pointers...