Handmade Hero - Intro to C on Windows
Modified 2023-09-07
Day 1
Details of WinMain - 57:23
Windows calls the C Runtime Library (which comes shipped with all the C
compilers) and the CRT calls WinMain, which is the default entry point to
execute the GUI application. Console applications have main as their entry
point.
#include <windows.h>
int CALLBACK WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
OutputDebugStringA("Some function\n");
return 0;
};Day 2
Debuggers
The best debugger for Linux seems to be the gdb -tui debugger, but I prefer to
use the gf gdb frontend as it's easier to set the breakpoints and see the
context in code.
Day 3
Speed of light / processor speed = how far the light travels with each cpu tick. So, in general the light can't even travel from the CPU to RAM, and back within a cpu tick.
The latency is reduced by providing small caches inside the CPU, while the bandwidth is sending as much stuff down the wire, which is easier to improve.
Day 4
The compiler is not constraint to lay each of the fields as compact as possible.
A char might be respresented by 4 bytes if the processor if it's optimized to
access values on 4 bytes boundaries (as it might be slower to access a single
byte).
Day 5
Metadata
- Creator(s)
Casey Muratori
Dennis Present
I'm interested in understanding how game engines and games work from scratch and I have zero experience with C, so this was the bare minimum of C I would need to follow along with the regular videos.