C++

[C++] ThreadSanitizer

ThreadSanitizer is a data race detector for C/C++. Data races are one of the most common and hardest to debug types of bugs in concurrent systems.
Here is an example of a data race that can lead to crashes and memory corruptions:

[C++] How to install gcc-7 on Ubuntu LTS 16.04

[C++] Return absolute_path using boost::filesystem

Return absolute_path using boost::filesystem

Note:
You’ll need to add the boost libraries to the linking phase with the -L flag and the names of the libraries with the -l flag. This is different from the compilation phase where only the -I include path is needed. For example in my case:

boost::filesystem tutorials
https://meetingcpp.com/blog/items/handling-files-using-boost-filesystem.html
http://www.boost.org/doc/libs/1_55_0/libs/filesystem/doc/tutorial.html
http://www.boost.org/doc/libs/1_44_0/libs/filesystem/v3/doc/tutorial.html
http://www.boost.org/doc/libs/1_51_0/libs/filesystem/doc/reference.html#Absolute-path
http://www.boost.org/doc/libs/1_53_0/libs/filesystem/doc/reference.html
http://www.boost.org/doc/libs/1_55_0/libs/filesystem/doc/reference.html#copy_file
http://wiki.lihebi.com/boost.html

The Boost C++ Libraries
AdvC++Libs.key
boost-graph-library
asio_doc
dima-boost-intro
Boost_for_KDE_Developers-Volker_Krause

[C++] An Interesting Bit Array Example

Here is an interesting bit array task and its solution in C++ that I thought it’s worth to share with you.
You are given four integers values: N, A, B, and C. You need to use them in order to create the sequence called bitArray with the following pseudo-code:

Task: calculate the number of distinct integer in the bitArray sequence.

Solution
Input: four space separated integers on a single line, N, A, B, and C  respectively.
Where N = 32, A = 16, B = 16, C = 16.
Output: 
one integer that denotes the number of distinct integer in the bitArray sequence equals 7 as we set N, A, B, C values.

If you’d like to read the input from the console simply comment out line 57 and 62 and toggle comment selection on line 58, 59, 60 and 61.
Input read from the console:

four space separated integers on a single line, N, A, B, and C  respectively.
Output print to the console: 
One integer that denotes the number of distinct integer in the sequence called bitArray.

The number of distinct integer  in the sequence  will be 536870912 when we change the previously set integer values to:

Use Wandbox online C++ compiler

[C++] cxx_status and support in Clang

Here is the list of current C++ implementation status and support in Clang as per Aug 2017.
You can find the complete list of features and minimum Clang version with support on the source page: https://clang.llvm.org/cxx_status.html

C++11 implementation status
Clang 3.3 and later implement all of the ISO C++ 2011 standard. By default, Clang builds C++ code according to the C++98 standard, with many C++11 features accepted as extensions. You can use Clang in C++11 mode with the -std=c++11 option. Clang’s C++11 mode can be used with libc++ or with gcc’s libstdc++.

C++14 implementation status
Clang 3.4 and later implement all of the ISO C++ 2014 standard.

You can use Clang in C++14 mode with the -std=c++14 option (use -std=c++1y in Clang 3.4 and earlier).

C++17 implementation status
Clang 5 and later implement all the features of the C++ 2017 Draft International Standard.
You can use Clang in C++17 mode with the -std=c++17 option (use -std=c++1z in Clang 4 and earlier).

C++2a implementation status
Clang has experimental support for some proposed features of the C++ standard following C++17, provisionally named C++2a. Note that support for these features may change or be removed without notice, as the draft C++2a standard evolves.
You can use Clang in C++2a mode with the -std=c++2a option.

More technical specifications and standing documents on the source page: https://clang.llvm.org/cxx_status.html