tags:

views:

74

answers:

2

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?

+1  A: 

Although undefining this empty macros is actually harmless, I would definitely avoid to reuse some well-known macro... It's like using goto as a variable name just because you are not using it as a keyword...

Lorenzo
+3  A: 

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.

Joshua Muskovitz