Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#define far, #define near Windef.h [duplicate]

Tags:

c++

windows

Possible Duplicate:
Is there a clean way to prevent windows.h from creating a near & far macro?

What's the point of these two defines in Windef.h?

#define far     /* nothing */
#define near    /* nothing */

I know it has to do with near and far pointers and the fact they're no longer used, but, is it safe to #undef them, so I can use near and far as function and variable names in my code?

Or, should I simply avoid it and never use near and far as identifiers?

like image 474
bobobobo Avatar asked Jun 15 '10 16:06

bobobobo


1 Answers

Don't reuse them. The last thing you need is to have to repeatedly explain to people that they aren't the old-school ornaments.

If it is critical to your app, you might consider using capitalized versions (since identifiers are case sensitive) - the compiler will catch typos when you mess up.

Just accept that this is cruft from the good old days when computers were still made from metal.

like image 120
Joshua Muskovitz Avatar answered Sep 30 '22 16:09

Joshua Muskovitz