Raymond Chen answered a question from commenter asdf in a post dated November 30, 2009. The question concerned the origin of WIN32_LEAN_AND_MEAN.
Microsoft introduced the symbol around the Windows 95 transition. Defining it while including windows.h suppresses a group of additional Windows header files. The exact group can be checked in windows.h.
The change accompanied the move from 16-bit to 32-bit Windows. The earlier 16-bit windows.h omitted those files, so the macro restored a lean header model for small Windows programs. It also suited developers who wanted tight control over their headers. Precompiled headers were not common at the time.
Chen recalled a 50MHz 80486 system with 8MB of memory compiling each C file about three seconds faster with the macro. A project containing 20 C files saved about one minute. Moore’s Law and the wider use of precompiled headers later reduced the benefit to very little. The macro once had a practical job.




Comments
No comments yet — be the first.
Open the discussion
No account or password needed — just enter your e-mail and we’ll send you a one-time sign-in link. First time here? You’re set up automatically.
Your rating will be applied automatically after you sign in.
Check your inbox
We’ve sent a sign-in link to …. Open it on this device — this tab will sign you in automatically.
Nothing arrived? Check your spam folder — and mark the mail as "Not spam" so it lands in your inbox next time.