Answers

Newest first. When a later standard changes an answer, the article is updated in place and says what changed and since when.

Each answer names the standard it is written for: 111417202326

Document
Answers
Answers
23, newest first
Page
1 of 3
Written by
,
Sections
All eight
Feed
RSS
  1. Can a C++ destructor throw? What happens since C++11

    Since C++11 a throwing destructor calls std::terminate. What noexcept(false) changes, why containers forbid it, and how to report failure from close().

    Language §1.1Miriam Castellanos9 min readC++20

    written for C++20

  2. Clang vs GCC: what differs for a C++ project

    Clang vs GCC for C++: default standard, libstdc++ or libc++, C++26 features and warnings, each built on GCC 16.2 and Clang 23.1, then tools and which to pick.

    Tooling §6.1Tobias Mwangi14 min readC++23

    written for C++23

  3. C++ expression templates explained with a C++20 example

    Build a C++20 expression template that runs a + b + c in one loop with no temporaries, count what it removes, and see when Eigen or ranges fit better.

    Templates §3.1Miriam Castellanos12 min readC++20

    written for C++20

  4. C++ generators: co_yield and std::generator

    Write a lazy sequence with co_yield: std::generator in C++23, a complete C++20 generator for libraries without it, and the lifetime rules that stop dangling.

    Concurrency §5.1Miriam Castellanos7 min readC++23

    written for C++23

  5. C++ int to string: to_string, format or to_chars, not itoa

    Convert an int to a string in C++ with std::to_string, std::format or std::to_chars: the exact output of each, what allocates, and why itoa is not standard.

    Standard Library §2.1Miriam Castellanos6 min readC++17

    written for C++17

  6. Strings as C++ template parameters with C++20 fixed_string

    A string literal can’t be the argument of a pointer template parameter. How a C++20 fixed_string type fixes that, what came before, and what C++26 adds.

    Templates §3.2Miriam Castellanos11 min readC++20

    written for C++20

  7. C++ string to int: std::stoi or std::from_chars, not atoi

    Convert a string to int in C++ with std::stoi or std::from_chars, reject trailing text, and see what each call, atoi included, does with bad input.

    Standard Library §2.2Miriam Castellanos11 min readC++17

    written for C++17

  8. C++ virtual functions: override, pure virtual and the traps

    How a C++ virtual function call is resolved, why to write override and a virtual destructor, pure virtual functions, and which warnings catch the traps.

    Language §1.2Miriam Castellanos9 min readC++11

    written for C++11

  9. C++ vs C: what differs, what breaks, which to choose

    C++ vs C in compiled code: the valid C that four compilers reject as C++, how C23 moved toward C++, how extern “C” joins the two, and when to pick C.

    Careers §8.1Tobias Mwangi14 min readC++23

    written for C++23

  10. C++20 concepts: how to write and use them

    Constrain C++20 templates with concepts: the four ways to write a constraint, requires expressions, the standard concepts, overloading, and what is not checked.

    Standards §7.1Miriam Castellanos13 min readC++20

    written for C++20