Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is my favorite macro: "#define WIN32_LEAN_AND_MEAN"

Why is it that even though Github or what ever has cutsie unicorns (or whatever it is) as error messages it feels fake and contrived while this define just feels like some random dude at MS naming it before going off to write Solitaire?



Don't forget `WIN32_EXTRA_LEAN`! Still no idea what that does/did.

For those curious about WIN32_LEAN_AND_MEAN - it reduces compile time by not auto-including a number of windows headers: https://devblogs.microsoft.com/oldnewthing/20091130-00/?p=15...


Do you mean VC_EXTRALEAN? Or is WIN32_EXTRA_LEAN also a thing?


First time I hear of VC_EXTRALEAN, always used WIN32_EXTRA_LEAN.


The bad news is that WIN32_EXTRA_LEAN has no effect, you have to define VC_EXTRALEAN if you want to exclude extra stuff from the MFC and VC headers.

The good news is also that it has no effect. :)

You can verify this for yourself by grepping the Visual Studio headers for VC_EXTRALEAN and WIN32_EXTRA_LEAN.


But it did in 2005?

> VC_EXTRALEAN defines WIN32_LEAN_AND_MEAN and a number of NOservice definitions, such as NOCOMM and NOSOUND.

> https://gamedev.net/forums/topic/367942-win32_lean_and_mean-...


WIN32_EXTRA_LEAN != WIN32_LEAN_AND_MEAN


As always, Raymond Chen wrote about it! https://devblogs.microsoft.com/oldnewthing/20091130-00/?p=15...

Its also my favorite btw.


We've had to use this at my work a couple times. I forget the exact reasoning, but IIRC if you're using including parts of the Win32 API, you get some things that would stomp on C or C++ names, which is bad. Macros like that one prevent loading things you don't want.

One example was min and max - Win32 includes those which messes with trying to use std::min and std::max.


There's NOMINMAX, NOGDI, etc. for that.


not only min, max, other "fun" ones to debug are "near", "far", "small"


I think we had to use that when importing FDI.h (the CAB-extracting part of winapi) to avoid it bringing more legacy cruft.


I've always been a fan of _CRT_SECURE_NO_WARNINGS, personally.


Probably because you're the same generation as the dude at MS, whereas you want the kids at Github to get off your lawn?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: