C++ Initialization Gotcha: The Subtleties of `=default`

2025-05-15

This article delves into the perplexing world of C++ initialization. A simple example reveals the significant impact of the placement of `=default` on the initialization of struct members: struct members with `=default` in the declaration are zero-initialized (value 0), while those with `=default` in the definition have indeterminate values, leading to undefined behavior if read. The article thoroughly explains the differences between default, value, and zero initialization, and emphasizes the importance of explicitly initializing variables to avoid potential bugs and security risks.

Read more
Development Initialization

Building Your Own Linux Debugger: Part 1 - Getting Started

2025-04-25

This is the first part of a ten-part series on building a Linux debugger from scratch. Learn the core mechanics of debuggers and implement features like launch, halt, continue, breakpoint setting (memory addresses, source lines, function entry), register and memory read/write, and single stepping. The tutorial uses C/C++, Linenoise, and libelfin, with each part's code available on GitHub. Future parts will cover advanced topics such as remote debugging, shared library support, expression evaluation, and multi-threaded debugging.

Read more
Development