Sunday, October 25, 2020

2020-10-25 Sunday - GNU Compiler Collection (GCC) 10.2


 

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)

Or, alternatively, you may wish to try LLVM

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++."
Some older books, that may also be of interest as background reading:

Useful Tutorials - General C++

Useful Tutorials - POSIX Threads

References

No comments:

Copyright

© 2001-2021 International Technology Ventures, Inc., All Rights Reserved.