March 13th, 2013 03:10 PM
#1
enum versus private enum
The following code works in VC++ 2010 but generates numerous errors in VC++ 2012:
#include "stdafx.h"
using namespace System;
enum class Months{January = 1, February, March, April };
int main(array<System::String ^> ^args)
{
Months month;
int value;
month = Months::January;
value = safe_cast<int>(month);
Console::WriteLine(L"Month is {0} and the value is {1}.", month, value);
return 0;
}
In order to compile in VC++ 2012, the code must be changed to:
private enum class Months{January = 1, February, March, April };
My question is why?
Is VC++ so chaotic that code from one version won't compile in another version? Doesn't that defy the idea of portable code?
March 13th, 2013 03:33 PM
#2
Re: enum versus private enum
Wrong Forum!
This Forum is for
Visual C++ Programming
Ask questions about Windows programming with Visual C++ and help others by answering their questions.
and not for a managed C++/CLI one!
Victor Nijegorodov
March 13th, 2013 03:53 PM
#3
Re: enum versus private enum
I'm going to move it there. I hope you'll answer me there.
March 13th, 2013 07:47 PM
#4
Re: enum versus private enum
Well I guess not.
I'm not looking for hall monitors, I'm looking for help and it appears I'm in the wrong place.
Nice plaque - it swept me off my feet. Bye.
March 14th, 2013 01:54 AM
#5
Re: enum versus private enum
Well, you are now in the right place: "Managed C++ and C++/CLI".
Not because some evil "hall monitors" just want to move your posts, but to give you a better chance to get an answer.
[ Moved thread ]
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks