I found this strange codes in winnt.h
file in VS2013.
#ifdef STRICT
typedef void *HANDLE;
#if 0 && (_MSC_VER > 1000) // strange code is here...
#define DECLARE_HANDLE(name) struct name##__; typedef struct name##__ *name
#else
#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
#endif
Based on my understanding, when _MSC_VER
is defined larger than 1000
or less than 1000
, this line #if 0 && (_MSC_VER > 1000
should equal to #if 0
. Why #if 0 && (_MSC_VER > 1000
is this defined in such a strange way?
Most likely, it is generated code, with the 0
injected by some stage of the build or packaging process that has discovered the feature is unnecessary on your platform.
Why does it not instead remove the whole #if
and keep only the #else
body Because (in general) that would be a lot more difficult and error-prone for a simple tool to do: replacing something that probably looks like #if <placeholder>
with #if 0
is easy.
I almost considered trying to figure out precisely what's going on in this specific case, but then I noticed it's WinNT code and decided maintaining whatever remains of my sanity was more important.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.