WIN32和_WIN32的区别

WIN32 is a name that you could use and even define in your own code and so might clash with Microsoft's usage. _WIN32 is a name that is reserved for the implementor (tn this case MS) because it begins with an underscore and an uppercase letter - you are not allowed to define reserved names in your own code, so there can be no clash.
  • WIN32 is defined by the SDK or the build environment, so it does not use the implementation reserved namespace
  • _WIN32 is defined by the compiler so it uses the underscore to place it in the implementation-reserved namespace

You'll find a similar set of dual defines with nearly identical names and similar uses such as _UNICODE/UNICODE, _DEBUG/DEBUG, or maybe _DLL/DLL (I think that only the UNICODE ones get much of any use in their different versions). Though sometimes in these cases (like _UNICODE), instead of the underscore version being defined by the compiler, they are used to control what the CRT headers do:

  • _UNICODE tells the CRT headers that CRT names which can be either Unicode or ANSI (such as _tcslen() should map to the wide character variant (wcslen())
  • UNICODE does something similar for the SDK (maps Win32 APIs to their "W" variants)

参见:http://stackoverflow.com/questions/662084/whats-the-difference-between-the-win32-and-win32-defines-in-c

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dvlinker

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值