March 10, 2026

Infinite loops, infinite drama

Practical Guide to Bare Metal C++

Bare‑Metal C++ Guide says “Just loop forever” — and the comments explode

TLDR: A bare‑metal C++ guide says keep the program running forever and hand‑roll tiny replacements for missing features to work without a standard toolkit. Comments erupted into a C‑vs‑C++ slugfest, with critics calling it outdated while others asked for beginner‑friendly resources and joked about “infinite loop” lifestyles.

A new “Practical Guide to Bare Metal C++” tells readers to write programs that never exit and to skip the usual cleanup — because on tiny devices with no operating system, there’s nowhere to return to anyway. The guide also shows how to build without the standard C++ toolkit and plug the gaps by adding your own “do nothing” delete function and a panic handler for “pure virtual” calls. Think: coding straight on the chip with training wheels off, as explained in the guide and what “bare metal” means on Wikipedia.

The comment section? Pure fireworks. One camp called the tactics dated: pjmlp says today’s C++ has smarter tools, like “constexpr” and “concepts,” so old tricks should stay in the museum. Another voice, menaerus, slammed the whole thing as “outdated, opinionated, platform‑specific, and incorrect,” cueing a chorus of side‑eyes. Then myrmidon lit the classic fuse: why not just use C and skip C++’s complexity entirely? Cue the eternal C vs. C++ rematch.

Not everyone brought pitchforks. Some praised the write‑up’s clarity while asking for a friendlier intro, with saltmate hunting for beginner‑friendly links. Meanwhile, humor flowed: “Infinite loop as a lifestyle,” and “flash LEDs to report errors = Morse code debugging.” Even a link jumping halfway down the page became a meme: “Threading? Nah, just misplaced anchors.”

Key Points

  • Design main as a non‑returning infinite loop in bare‑metal C++ to avoid global/static object destruction logic.
  • Compiling with -nostdlib can cause undefined references to __cxa_pure_virtual and operator delete(void*).
  • __cxa_pure_virtual resides in vtables for pure virtual functions and can be stubbed with an infinite loop in bare‑metal builds.
  • Operator delete is required because the vtable includes a deleting destructor that invokes it, even without dynamic allocation in code.
  • Disassembly shows vtables in .rodata and maps entries to destructors and functions, explaining the observed link dependencies.

Hottest takes

“there are much better alternatives with constexpr, and concepts” — pjmlp
“Outdated, opinionated, platform-specific, and incorrect” — menaerus
“everything you can do in C++ you can do in C with a lot less language complexity” — myrmidon
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.