Re: variable scope in for loop
Ron Natalie wrote:
<snip> macro redefining "for" to get around a non-compliance </>
[color=blue]
> By making this change, once, with the approval of our design team
> and putting it in a controlled place, it gets around a zillion Microsoft
> specific hacks that involve bad coding practices of leaving variables
> uninitialized or sitting around outside the scope they are used in.
>
> I'm not recommending the willy nilly redefining of keywords, but in
> this case making the tested, controlled, one line change IS LESS
> INTRUSIVE, than having to break standard-conforming code everywhere
> else it appears OR adding bad programming practices because the
> compiler is busted.[/color]
Of course, you'll have to include the macro in each source file using a
"for" loop. You'll need to be careful not to include before any of the
MS headers, too, to avoid breaking them.
Ron Natalie wrote:
<snip> macro redefining "for" to get around a non-compliance </>
[color=blue]
> By making this change, once, with the approval of our design team
> and putting it in a controlled place, it gets around a zillion Microsoft
> specific hacks that involve bad coding practices of leaving variables
> uninitialized or sitting around outside the scope they are used in.
>
> I'm not recommending the willy nilly redefining of keywords, but in
> this case making the tested, controlled, one line change IS LESS
> INTRUSIVE, than having to break standard-conforming code everywhere
> else it appears OR adding bad programming practices because the
> compiler is busted.[/color]
Of course, you'll have to include the macro in each source file using a
"for" loop. You'll need to be careful not to include before any of the
MS headers, too, to avoid breaking them.
Comment