Skip to content

Instantly share code, notes, and snippets.

@B-Y-P
Last active May 22, 2026 05:56
Show Gist options
  • Select an option

  • Save B-Y-P/91e6ad1c6b13c65a8ad695d3f70582a4 to your computer and use it in GitHub Desktop.

Select an option

Save B-Y-P/91e6ad1c6b13c65a8ad695d3f70582a4 to your computer and use it in GitHub Desktop.
BYP - Handmade Replay Notes

// TODO

Day 001

The main dev tools Casey uses are Emacs as his text editor, MSVC as his compiler, and Visual Studio as his debugger

Alternatives that I'll be using:

4coder is an editor which was developed contemporaneously with Handmade Hero
Likewise for the debugger RemedyBG


#include <windows.h>

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){
  MessageBoxA(NULL, "Text", "Caption", 0);
}
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#include <windows.h>

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){
  MessageBoxA(NULL, "Text", "Caption", 0);
}

[...] at the time the symbol was introduced, precompiled header files were not in common use. As I recall, on a 50MHz 80486 with 8MB of memory, switching to WIN32_LEAN_AND_MEAN shaved three seconds off the compile time of each C file. When your project consists of 20 C files, that’s a whole minute saved right there.

Where did WIN32_LEAN_AND_MEAN come from?

Now imagine we took this to its extreme

typedef void* HINSTANCE;
typedef unsigned int UINT;
typedef char* LPSTR;
typedef const char* LPCSTR;

int MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){
  MessageBoxA(NULL, "Text", "Caption", 0);
}
typedef void* HINSTANCE;
typedef unsigned int UINT;
typedef char* LPSTR;
typedef const char* LPCSTR;

extern "C" __declspec(dllimport) int __stdcall MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);

#pragma comment(lib, "user32.lib")

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){
  MessageBoxA(NULL, "Text", "Caption", 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment