Skip to content

Latest commit

 

History

History
51 lines (50 loc) · 4.76 KB

README.md

File metadata and controls

51 lines (50 loc) · 4.76 KB

Source code

Download sources vs. Compiler Explorer Links

You can download the sources and build them locally. Or you can follow the compiler explorer links to single examples. Here are the main differences:

  • The compiler explorer version needs very new compilers to work. For the downloadable source package, I put in some effort so they would run (with some limitations) on compilers that are a few years old.
  • On compiler explorer, every example is in a single file. This includes the actual example, but all the utilities and helper code to make it work. By comparison, the source packages are better structured, and use shared files where that makes sense

Build and run locally

Just download the "source" folder and open CMakeLists.txt in a cmake-capable IDE of your choice. Some features will only work with pretty new compilers (where necessary, I coded workarounds for older compilers). Two examples (Continuation, Continuation & Writer) will only work if you have Qt 6 installed, they will simply not show if you don't have it.

Compiler versions tested:

  • GCC 13 (tested via MinGW)
  • GCC 14
  • Clang 17
  • Clang 18
  • MSVC 19.40 (VS 2022)

Minimum compiler version required:

  • GCC 13
  • Clang 17
  • MSVC 19.33

Notes

Use of stacktrace is hard-disabled for GCC in downloadable sources. The feature test macro __cpp_lib_stacktrace will report support for stacktrace in GCC, but linking will fail unless you specify -lstdc++exp. If you want to enable stacktrace for GCC, remove the protective #ifndef GNUC in compilerinfo.h

Compiler explorer links

As mentioned above, each example only consists of one file. For that reason, it's typically good to start reading the example from the bottom (main function). The code compiler explorer does not support all compilers:

  • clang cannot handle some examples due to lack of stacktrace support
  • GCC 14 works, but needs a special linker flag (-lstdc++exp)
  • Reasonably new version of MSVC also work

In any case, you need to set C++23 as standard version if you want to add compilers. If you need more portable code, take a look at the downloadable sources

Main talk examples