acodercat/function-calls-under-the-hood
Sobre
What happens when you call a function? A visual guide to understanding stack frames, control transfer, and function call mechanics through assembly language.
Aprendizado e educaçãoCrescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- 0
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalFunction Calls Under the Hood
What happens when you call a function?
A visual guide to function call principles through assembly language.

About This Guide
This visual guide explains how function calls work at the low level, using detailed diagrams to illustrate the complete stack evolution during function execution. Through hands-on examples on the x86-64 platform, you'll gain a solid understanding of how C code translates to assembly instructions. The guide concludes with practical examples demonstrating interesting stack frame behaviors.
What You Will Learn
- How control transfers between functions
- How data is passed between functions
- How stack frames are created and destroyed
- The dangers of array out-of-bounds access in C/C++
- Why inline functions are more efficient
- Why loops are preferred over recursion
- Why static variables persist after function returns
- What stack overflow attacks are and how they work
Table of Contents
- Prerequisites
- The Stack in Memory
- Control Transfer
- Data Passing
- Register Saving and Restoring
- Storage of Local Variables
- Function Stack Frame
- C Function Stack Frame Example
- Stack Frame Memory Reuse
- Manually Modifying Stack Frame Data
- Summary
References
Books:
- "Computer Systems: A Programmer's Perspective" (3rd Edition)
Online Courses:
Acknowledgments
All diagrams were created with Excalidraw.
Translation assisted by Claude (Anthropic).
License
MIT
Explore projetos relacionados
Carregando…