views:

272

answers:

2

Hi!

When I try to compile some code (not my own) i get a C2589 '(':illegal token on right side of'::'

on this line:

    maxPosition[0]=std::numeric_limits<double>::min();

i guess this is because there is already a min() macro defined, but why is the compiler not taking the min() from the specified namespace instead of the macro?

A: 

Same as my error - See answers here.

Hope this helps.

Harvey
+2  A: 

but why is the compiler not taking the min() from the specified namespace instead of the macro?

Because macros don't care about your namespaces, language semantics, or your compiler. The preprocessing happens first.

In other words, the compiler only sees what is left after the preprocessing stage. And min was replaces by some replacement string, and the result is what the compiler saw.

Alex