Re: Win32 Build Issues

Subject: Re: Win32 Build Issues
From: David Given (
Date: Tue Aug 07 2001 - 11:32:21 CDT

> MSVC gives the loop var i the scope of the outer block instead of the
> for loop, so it gives an error for i being multiply defined.

MSVC's behaviour is incorrect. The current standard decrees that any variables
declared in a for() statement only have scope inside the loop --- but it used
not to be the case. (gcc has an option, -fno-for-scope, to change the scoping
rules when compiling old code.)

> To fix this, we could (a) rename one of the vars, (b) remove one of the
> definitions, or (c) turn off MS language extensions in the compiler (/Za
> option). Doing 'c' causes problems in some other file, because MSVC
> won't cast an enumeration value to a (void *) unless MS extensions are
> on. I couldn't fine a way to selectively enable exensions. Whaddya want?

Casting enums to a void*? Eeek! Don't do this! It's illegal! C++ won't let you
cast *anything* to a pointer implicitly unless it's a pointer of compatible

Solution: turn off MSVC extensions and fix the code. It shouldn't be compiling
under gcc anyway.

[Signature under construction]

This archive was generated by hypermail 2b25 : Tue Aug 07 2001 - 11:32:24 CDT