Articles

Deep-dive technical articles on computer science, networking, and systems programming.

18articles
3topics
1 hof reading

C / C++

14 articles

C++ Streams and Formatting Manipulators

6 min
How to control output formatting in C++ using ios_base flags, setf/unsetf, precision, width, fill, and stream manipulators.

Comments

3 min
Best practices for writing code comments, documentation tools like JavaDoc and Doxygen, and using CVS and XML documentation comments.

Debug and Release Builds

3 min
The differences between debug and release builds, symbol tables, and how to use GDB for debugging compiled programs.

Game Trees

4 min
An introduction to game trees and the minimax algorithm for building AI in two-player games like chess and tic-tac-toe.

Global Variables

3 min
Why global variables are harmful to software design, and what environment variables and lessons from C and .NET era teach us.

Introduction to C++ Streams

5 min
A comprehensive introduction to the C++ stream I/O library, covering cin, cout, cerr, clog, stream operators, error handling, and character-level input.

Introduction to Operator Overloading

5 min
How C++ operator overloading lets you define the behaviour of operators for user-defined types, covering member functions, global functions, friend functions, and unary operators.

Introduction to Templates

5 min
How C++ templates enable generic programming, template functions, behind-the-scenes instantiation, overloading, specialisation, explicit instantiation, and template classes.

Macro Overloading

1 min
How a macro and a function can share the same name in C, and how to force the function version to be called by wrapping the name in parentheses.

Macro Usage

1 min
A key rule for defining macros in C, always parenthesize macro definitions to avoid operator precedence bugs.

Magic Numbers

4 min
Why hardcoded numeric literals in code are harmful, and how to replace them with named constants, macros, enumerations, or typed constants.

Null Pointer

1 min
Why NULL is reserved for pointer operations in C, how it is defined, and why mixing it with integer zero causes problems.

Processor Modes

1 min
Why grouping similar CPU instructions together improves performance by reducing mode-switching overhead, illustrated with the Pentium MMX example.

Type Qualifiers

6 min
The three C type qualifiers, const, volatile, and restrict, what they mean, and how to apply them to variables, pointers, and objects.