Skip to content

Instantly share code, notes, and snippets.

@Eisenwave
Eisenwave / pointers.md
Last active October 23, 2024 20:43
How pointers in C++ actually work

How pointers in C++ actually work

Abstract: This document teaches you from the very basics to advanced features such as std::launder how pointers in C++ work. It is aimed at developers of any skill level. However, it links to the C++ standard so that advanced readers can verify the information and investigate further.

Motivation: Most tutorials on pointers are aimed at beginners, and present a simplified model. Some tutorials perpetuate an explanation of pointers that is solely based on their implementation (pointer = memory address). This tutorial aims to provide a comprehensive explanation of pointers that is in line with how they actually work from a language perspective.