RSSAmplifier

Blog

Nimrod's Coding Lab

Recent content on Nimrod's Coding Lab

nimrod.blogRSS feed ↗15 posts

Latest posts

C++26 Pack Indexing

C++26 pack indexing lets you select types and values from parameter packs directly with pack…[I], which removes a lot of tuple and index_sequence ceremony from metaprogramming utilities.

Common Sandpiper at Nanhui

Virtual Function Costs

Measuring real performance cost of C++ virtual functions: vtable lookup overhead, branch misprediction, devirtualization, and when to avoid virtual dispatch.

C++ Type Dispatch

Techniques for type dispatch in C++: tag dispatch, if constexpr, std::variant with std::visit, and how to choose the right approach for your use case.

How to Resolve Macro Name Collisions

Practical techniques to resolve C/C++ macro name collisions between system headers and user code: undef, parenthesization, and inline function workarounds.

C++: How to Access Private Members VALIDLY

A surprisingly valid C++ technique to access private class members using explicit template instantiation, with analysis of what the standard actually permits.

C++: Elegant Ways to Map Runtime Values to Types

How to elegantly dispatch from runtime values to compile-time types in C++ using techniques like std::variant, type lists, and template metaprogramming.

Algorithms behind Popcount

Three classical popcount algorithms: from naive bit-twiddling to the Hamming weight trick, plus how modern CPUs accelerate it with POPCNT and AVX-512.

C++ Virtual Table Tables(VTT)

A detailed walkthrough of how C++ virtual table of tables (VTT) works for classes with virtual base classes, with concrete memory layout examples.

What does C++ Object Layout Look Like?

Visual walkthrough of C++ object memory layout: member ordering, padding, base class subobjects, vtable pointers, and how multiple inheritance affects layout.

A Subtle Bug Before C++17

A deep dive into a subtle C++ performance bug: why over-aligned dynamic memory allocation was undefined before C++17 and how alignas interacts with operator new.

Iyengar111 NanoLog Source Code Reading

Deep dive into NanoLog, an extremely fast C++ logging library: how it achieves nanosecond-scale latency with lock-free queues and cache-line alignment.

Glog Source Code Reading Notes

Source code analysis of Google’s glog logging library: how it handles log severity, log file rotation, signal handling, and thread safety.

How to Return Values Effectively in C++

A guide to returning values effectively in C++: RVO, NRVO, move semantics, and when to use out parameters — with benchmarks and compiler guarantees.

About Me

about