Thanks Ron. I'll get to cleaning up our code then.
Craig
> The fact that the VC 7.1 compiler allowed this was a bug that we fixed for
> the 2005 version. Enums are not scope qualified according to both the C and
[quoted text clipped - 53 lines]
> >
> > Craig Klementowski
> The fact that the VC 7.1 compiler allowed this was a bug that we fixed for
> the 2005 version. Enums are not scope qualified according to both the C and
> C++ standards.
>
> Ronald Laeremans
> Visual C++ team
Ron,
Given all the extensive language extensions provided as part of .NET,
I think it would be a very good idea to leave the enum scope
qualification as a language extension.
Not only does it make MC++ more similar to C#.NET, but it's simply a
good idea on its own regard. Lack of enum scoping frequently forces
name mutilation into the enum fields:
enum EColor
{
eColor_Red,
eColor_Blue,
}
This sucks in any case where you want to use the textual value of the
enum for printout purposes.
Finally, doesn't removing enum scope qualification in MC++ introduce
possibilities where MC++ will be unable to interact with enums defined
in C#.NET? Since C# supports enum scoping, it seems there could be
cases where duplicate enumerared values (potentially with different
meaning or numeric values) are defined in different enum types. C# can
handle this fine, but MC++ cannot?
Thanks,
-ken
Ronald Laeremans [MSFT] - 29 Jul 2004 00:19 GMT
Hi Ken,
enum class Foo {... } will act identical to an enum defined in C# or another
CLR language.
enum Foo { ... } will act as per the ANSI/ISO C and C++ standards.
If you want a non managed enum to behave the same it is fairly easy to write
a class in standard C++ that has the scoped behavior and use that instead.
Ronald
>> The fact that the VC 7.1 compiler allowed this was a bug that we fixed
>> for
[quoted text clipped - 33 lines]
> Thanks,
> -ken