For one who seeks to be a master of their craft - you must continually attend to sharpening the saw.
Today: A deep dive back into C++ POSIX threaded programming, using the G++ compiler, available with the GNU Compiler Collection (GCC 10.2) - and exploring the differences in C++17, and the experimental implementation of some C++20 features.
GCC References
Eclipse: C/C++ Development Toolkit (CDT) Resources
Although I usually rely on Microsoft Visual Studio (or Visual Studio Code) as my primary IDEs - I'm forcing myself to use Eclipse ("2020-09" CDT release) - so that I maintain familiarity & proficiency:
- https://www.eclipse.org/cdt/
- https://www.eclipse.org/cdt/documentation.php
- "The C/C++ Development Toolkit (CDT) is a collection of Eclipse-based features that provides the capability to create, edit, navigate, build, and debug projects that use C and/or C++ as a programming language."
- "The CDT does not include the necessary compilers and debuggers to convert C/C++ code into executable programs and to debug those programs, but it does provide the frameworks that allow such tools to be integrated in a consistent fashion. This allows you to mix and match such tools depending on your project requirements."
...which leads to suggesting:
Cygwin
- https://cygwin.com/
- Once you have the GCC G++ elements installed, run "g++ -v" at the command line, and you should get something like this:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/10/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /mnt/share/cygpkgs/gcc/gcc.x86_64/src/gcc-10.2.0/configure --srcdir=/mnt/share/cygpkgs/gcc/gcc.x86_64/src/gcc-10.2.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --with-gcc-major-version-only --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC)
LLVM & Clang
"The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines. The name "LLVM" itself is not an acronym; it is the full name of the project."
"LLVM began as a research project at the University of Illinois, with the goal of providing a modern, SSA-based compilation strategy capable of supporting both static and dynamic compilation of arbitrary programming languages. Since then, LLVM has grown to be an umbrella project consisting of a number of subprojects, many of which are being used in production by a wide variety of commercial and open source projects as well as being widely used in academic research. Code in the LLVM project is licensed under the "Apache 2.0 License with LLVM exceptions" "
- "clang fully implements all of standard C++98 except for exported templates (which were removed in C++11), all of standard C++11, C++14, and C++17, and most of C++20."
Suggested Books:
"Coverage begins with the basics, then ranges widely through more advanced topics, including many that are new in C++17, such as move semantics, uniform initialization, lambda expressions, improved containers, random numbers, and concurrency. The tour even covers some extensions being made for C++20, such as concepts and modules, and ends with a discussion of the design and evolution of C++."
- The C++ Programming Language, 4th Edition 4th Edition (2013), by Bjarne Stroustrup
- See Chapter 42, for Threads and Tasks
- C++20 Recipes: A Problem-Solution Approach 2nd ed. Edition (April 2020)
- C++ Concurrency in Action 2nd Edition (Feb 2019)
- "This bestseller has been updated and revised to cover all the latest changes to C++ 14 and 17! C++ Concurrency in Action, Second Edition teaches you everything you need to write robust and elegant multithreaded applications in C++17."
- "Anthony Williams is a UK-based developer and consultant with many years experience in C++. He has been an active member of the BSI C++ Standards Panel since 2001, and is author or coauthor of many of the C++ Standards Committee papers that led up to the inclusion of the thread library in the new C++ Standard, known as C++11 or C++0x. He has been the maintainer of the Boost Thread library since 2006, and is the developer of the just::thread implementation of the C++11 thread library from Just Software Solutions Ltd."
- C++ Primer (6th Edition) 6th Edition (November 2, 2020)
- Large-Scale C++ Volume I: Process and Architecture (Addison-Wesley Professional Computing Series) 1st Edition (December 2019)
- Large-Scale C++ Volume II: Design and Implementation (Addison-Wesley Professional Computing Series) 1st Edition (March 2021)
- Advanced Programming in the UNIX Environment, 3rd Edition (2013)
- The Linux Programming Interface: A Linux and UNIX System Programming Handbook 1st Edition (2010)
- Programming with POSIX Threads (1997)
- PThreads Programming: A POSIX Standard for Better Multiprocessing (A Nutshell Handbook) 1st Edition (1996)
Useful Tutorials - General C++
- https://www.w3schools.com/cpp/default.asp
- https://www.tutorialspoint.com/cplusplus/index.htm
- https://www.stroustrup.com/4thExercises.pdf
Useful Tutorials - POSIX Threads
- https://randu.org/tutorials/threads/
- https://www.cs.cmu.edu/afs/cs/academic/class/15492-f07/www/pthreads.html
- https://www.tutorialspoint.com/cplusplus/cpp_multithreading.htm
- https://www.fayewilliams.com/2015/03/31/pthreads-tutorial-linux-cpp/
- https://computing.llnl.gov/tutorials/pthreads/
References
- https://www.stroustrup.com/
- Wikipedia C++
- Wikipedia C++17
- Wikipedia C++20
- https://isocpp.org/
- http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
- https://isocpp.org/wiki/faq/how-to-learn-cpp
- https://isocpp.org/faq
- https://en.cppreference.com/w/
- http://www.cplusplus.com/
- http://www.open-std.org/JTC1/SC22/WG21/
- Wikipedia POSIX Threads
- POSIX.1-2017 The Open Group Base Specifications Issue 7, 2018 edition