[ODE] Macros

Daniel Wallin dalwan01 at student.umu.se
Wed Oct 2 04:28:02 2002


At 15:54 2002-09-30 -0700, Marco Grubert wrote:
>Well, if standard macros are evil then using macros to redefine keywords is
>evil-squared. I was wondering why my code would break whenever I included
>dxTrilist.h :
>
>// MSVC fixup.
>#define for if (false); else for
>
>I assume that the author's intent is to limit the variable scope (MSVC is
>not using the current C++ standard of restring for-variables to the scope of
>the loop). Please, please don't do this. The portable way is to not declare
>variables in the for header but before it.
>
>...

That is very good use of macros.. The way MSVC6.0 handles variable scope's in
for-loop's is a very frustrating bug, so if you absolutely have to use it, 
why not fix the
problem with the macro? I can't see how this macro could cause your code to 
break, unless
you are doing something like:

for (int i = 0;;)
{
}

int b = i;

in which case the fault is all yours..