Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ #定义远,定义近Windef.h_C++_Windows - Fatal编程技术网

C++ #定义远,定义近Windef.h

C++ #定义远,定义近Windef.h,c++,windows,C++,Windows,可能重复: 这两个定义在Windef.h中的意义是什么 #define far /* nothing */ #define near /* nothing */ 我知道这与指针以及它们不再被使用这一事实有关,但是,#undef它们安全吗,这样我就可以在代码中使用near和far作为函数名和变量名 或者,我应该避免使用它,并且永远不要使用near和far作为标识符吗?虽然取消定义这个空宏实际上是无害的,但我肯定会避免重用一些著名的宏。。。这就像使用goto作为变量名,只是因为您没

可能重复:

这两个定义在Windef.h中的意义是什么

#define far     /* nothing */
#define near    /* nothing */
我知道这与指针以及它们不再被使用这一事实有关,但是,
#undef
它们安全吗,这样我就可以在代码中使用
near
far
作为函数名和变量名


或者,我应该避免使用它,并且永远不要使用
near
far
作为标识符吗?

虽然取消定义这个空宏实际上是无害的,但我肯定会避免重用一些著名的宏。。。这就像使用
goto
作为变量名,只是因为您没有将其用作关键字…

不要重用它们。你最不需要的是反复向人们解释,它们不是老式的装饰品

如果对你的应用程序很重要,你可以考虑使用大写版本(因为标识符是区分大小写的)-当你搞错时编译器会抓到打印错误。


请接受这一事实:这是旧时代的产物,当时计算机仍然是由金属制成的。

一台80286机器重45磅!