AI summaryThe article explains the hidden compile-time algorithm that every C++ compiler uses to resolve a function call, which the author was motivated to understand after repeatedly encountering confusing errors about 'overloads with similar conversions.' It walks through the three main phases of the process—name lookup (including argument-dependent lookup), template argument deduction and substitution (introducing SFINAE), and overload resolution—using a concrete example to show how candidates are found and narrowed down. The author argues that understanding how these steps fit together is especially valuable for programmers developing libraries who combine multiple C++ features.
AI summaryThis post reviews the source code of Flap Hero, a small C++ game built without an existing game engine, explaining how it is organized using the Plywood framework and how it differs from larger game projects. The author evaluates the deliberate omission of typical engine subsystems—abstract scene representation, a shader manager, a physics engine, and an asset pipeline—rating each choice as OK, Good, or Bad based on the trade-offs involved. Overall, the article suggests Flap Hero is a valuable learning resource for novice and intermediate game developers, though some simplifications (like hand-managed shaders and no asset pipeline) proved disadvantageous.
AI summaryThe author has released Flap Hero, a free, open source Flappy Bird clone written entirely in C++, with MIT-licensed source code and public domain assets available on GitHub. The game was created to promote Plywood, a module-oriented open source C++ framework (not a game engine) that integrates third-party libraries like Assimp, SoLoud, stb, and GLFW through its workspace and built-in modules. Flap Hero exemplifies the lean, 'handmade' software style Plywood is designed to support, and the author plans future work such as a GUI build manager, with a source code review to follow in the next blog post.
AI summaryThe article describes how the open-source Plywood C++ framework automatically detects text file formats, addressing the inherent ambiguity of encodings like UTF-8, UTF-16 (with or without BOM), and Windows-1252, along with varying line endings. Plywood examines the first 4KB of a file, checks for valid UTF-8 decoding, and scores alternative encodings using heuristics based on whitespace, ASCII characters, and decoding errors. The author benchmarks this approach against a 50-file test suite, noting that editors like Notepad++, Sublime Text, VS Code, and Windows Notepad achieve comparable detection rates, and invites contributions to improve support for formats like Shift JIS on GitHub.
AI summaryThe article introduces the I/O system of Plywood, an open-source C++ framework, positioning it as a modern alternative to the decades-old standard C and C++ runtime I/O libraries. It explains core concepts such as the buffered OutStream and StringWriter classes, adapter-based chaining for newline conversion and character encoding (e.g., writing a UTF-16 file from UTF-8 input), and buffered text reading with InStream and StringReader, illustrated through code examples. The author also highlights design decisions like OutStream objects not being thread-safe, requiring explicit creation via StdOut::binary() or StdOut::text(), and Plywood's general preference for working with UTF-8 text internally.
AI summaryThe author has released Plywood, a cross-platform open source C++ framework extracted from their proprietary Arc80 game engine, which builds and runs on Windows, Linux, and macOS. Plywood is not a game engine itself but a general framework featuring a workspace for sharing code across applications, 36 built-in modules for tasks like platform abstraction and JSON parsing, and a runtime reflection and serialization system. The author plans future improvements such as simplifying module creation, extending the built-in C++ parser, and improving the webserver, and welcomes community feedback.
AI summaryThis article extends a runtime reflection system in C++11 by showing how to add support for new built-in types: primitive types like double are supported by specializing the getPrimitiveDescriptor<>() function template in any .cpp file, while template types like std::unique_ptr<> are handled through a partial specialization of the TypeResolver<> class template that generates a per-specialization type descriptor. It explains how these descriptors work internally, using template constructors and lambda-generated helper functions to handle each instantiation generically. Finally, the author discusses further improvements, such as replacing virtual functions with a table of function pointers (TypeKey) and using a Python script to auto-generate the reflection macros, and notes the system's heavy use in a custom game engine.
AI summaryThe article presents a small, flexible runtime reflection system for C++11 that uses preprocessor macros and templates to generate TypeDescriptor metadata objects describing the structure of other runtime types. Originally built to support serialization in the author's custom game engine, the system also powers features like 3D rendering and JSON asset importing. Through a compact 242-line GitHub sample project, the author demonstrates how the REFLECT() macros, SFINAE-based type resolution, and the TypeDescriptor class hierarchy work under the hood.
AI summaryThe author shares lessons learned from writing a C++ game engine from scratch for their mobile game Hop Out, arguing that modern engine development is more about managing self-created complexity than wrestling with weak hardware. Key advice includes using an iterative approach—getting something running quickly and letting the architecture emerge naturally rather than over-planning—and resisting the urge to unify code too much, such as blindly following DRY or forcing functions into classes. The article also warns that serialization is a bigger subject than many expect.
AI summaryThe author examines whether a compiler can reorder a write-release followed by a read-acquire on spinlocks, which would cause a thread to hold two locks at once and potentially introduce deadlock. Although acquire/release semantics alone don't forbid this reordering, he argues that C++ standard §4.7.2:18—which says atomic stores must eventually become visible to all other threads—should prevent moving the release store past a potentially infinite loop, so deadlock shouldn't be possible. He notes that the standard's wording is only a recommendation ('should' rather than 'must'), but concludes that acquire/release operations aren't inherently deadlock-prone, a view supported by compiler tests and commenter Anthony Williams.
AI summaryThe author, unable to find an up-to-date, dependency-free precompiled Cairo DLL for Windows, wrote a build script (shared on GitHub) and released binary packages containing headers, import libraries, and DLLs for x86 and x64. The DLLs are statically linked with their own C runtime, have no external dependencies, and should work with any MSVC-built application. They are configured to render text using FreeType for better quality, broader font format support, and consistent cross-platform appearance, and the author provides a sample CMake-based application to test them.
AI summaryThis article is a quick-start tutorial on CMake's scripting language, the language used in every CMakeLists.txt file to define build targets and perform other tasks. It covers the core syntax and programming model, explaining that all variables are strings, every statement is a command, lists are semicolon-delimited strings, and covering flow control, functions versus macros, script inclusion, and target properties. The goal is to help readers quickly grasp enough of the language to understand and edit CMake scripts without wading through scattered documentation.
AI summaryThis article is a practical guide to configuring and building CMake-based C/C++ projects, explaining core concepts such as the source and binary folders, the cache, and the configure and generate steps. It demonstrates several ways to run CMake—including the command line, cmake-gui, and ccmake—and how to generate build pipelines using Unix Makefiles, Visual Studio, and Xcode. The concepts are illustrated with a sample project called CMakeDemo, which uses SDL2 and OpenGL to render a spinning 3D logo.
AI summaryThis article demonstrates how to protect a shared data structure with concurrent readers and writers in C++ without using a read-write lock, by storing an atomic pointer to the current version and letting writers publish private modified copies. To safely delete old copies that threads may still be using, it introduces quiescent state-based reclamation (QSBR), where a MemoryReclaimer invokes deletion callbacks only after every participating thread has called onQuiescentState, grouping callbacks into intervals. The author notes the technique is related to userspace RCU and was used in the Junction library to implement a scalable resizable concurrent map.
AI summaryThe article introduces leapfrog probing, a new hash table probing strategy developed for the Junction library and inspired by hopscotch hashing, which stores two delta values per cell to form explicit probe chains for each bucket, reducing average search length compared to linear probing at a cost of only 12.5–25% extra memory. It describes how insertion works by following the probe chain, then linearly searching for a free cell and linking it to the chain, and how the concurrent Leapfrog map handles racing operations by reserving cells via CAS and linking them with relaxed atomic stores. Benchmarks showed Leapfrog was the fastest concurrent map tested up to a modest number of CPU cores, partly due to low write contention and resizing based on failed inserts rather than tracked population.
AI summaryThe article describes the Linear map from the Junction project, a concurrent hash map that improves on the earlier 'Crude' lock-free hash table by supporting both deletion and resizing. It explains how resizing works by atomically replacing a root pointer with a new, larger table and safely migrating entries using Redirect markers to prevent concurrent updates from being lost, along with a jobCoordinator that lets multiple threads participate in migrations. The author notes that Junction's Leapfrog and Grampa maps build on the same design, and shares the implementation as an educational example of concurrent programming.
AI summaryThe article announces Junction, a BSD-licensed C++ library offering several new concurrent hash maps—Linear, Leapfrog, and Grampa—whose fastest variants outperform all other concurrent maps tested on the author's hardware. These maps support atomic operations such as get, assign, exchange, and erase from multiple threads without locks, relying on quiescent state-based memory reclamation (QSBR) for safe memory management while requiring users to handle object lifetimes manually. The code is experimental alpha software, and the author invites feedback, bug reports, and contributions such as porting the Turf dependency library to additional platforms.
AI summaryThe article explains that C++11's atomic library provides several read-modify-write (RMW) operations, and that compare_exchange_weak (compare-and-swap) is the essential primitive from which any custom atomic RMW operation—such as a fetch_multiply—can be implemented via a CAS loop. It demonstrates that CAS loops can combine multiple computation steps, or even multiple variables packed into a single 32- or 64-bit integer (e.g., as a bitfield), into one atomic, lock-free operation. However, it cautions that the C++11 standard doesn't guarantee lock-free behavior, so developers should verify compiler and platform support, such as for std::atomic, std::atomic, or pointer specializations on x86, x64, or ARMv7.
AI summaryThe article presents a macro-based technique for defining 'safe bitfields' in C++, implemented with unions and class templates so that every operation—such as assignment, increment/decrement, and packed array indexing—is checked with runtime asserts to catch out-of-range values during development. It explains how the macros expand into a union whose members share a common initial sequence, which the C++ standard permits for standard-layout types, making the approach legal and free of undefined behavior. Since compilers inline the hidden function calls, the resulting machine code is as efficient as manual bit twiddling.
AI summaryThe article demonstrates that semaphores, though invented by Dijkstra in the early 1960s, are surprisingly versatile building blocks in multithreaded programming: using only semaphores and atomic operations, one can implement lightweight mutexes, auto-reset event objects, read-write locks, a solution to the dining philosophers problem, and a lightweight semaphore with partial spinning. The author describes a reusable 'box office/bouncer' pattern in which an atomic counter at the 'box office' makes decisions in userspace while the semaphore acts as the 'bouncer' managing waiting threads, allowing these primitives to avoid expensive system calls and optionally spin briefly before sleeping in the kernel. All implementations are provided as portable C++11 source code on GitHub, including a Semaphore class that maps to native semaphores on Windows, MacOS, iOS, Linux and other POSIX environments.