Skip to main content
GameDev.net gamedev.net
🔒 Locked

Enum and scopes

Started by Concentrate Nov 20, 2009 at 7:39 PM 3 replies 1k views
Original Post
Concentrate
Concentrate
So I got this warning : "warning C4482: nonstandard extension used: enum ... " In which was caused by this :
displayMode = DisplayMode::FILLED;
Then I found out or just realized that enum don't create its own namespace. Is there a particular reason why enums aren't given its own namespace? -------------------- EDIT: Fixed syntax; --------------------
MJP
MJP
Doing that doesn't even compile for me. I get that warning if I use something like "DisplayMode::FILLED", though.

I'm not sure why the C++ standard doesn't let you qualify enum values like that. At any rate Visual Studio supports it as a non-standard extension, so if you're only using that to compile then you can just suppress the warning and go to town.
Washu
Washu
Because the C standard didn't, and doing so would have broken most C programs.
In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.
AndyPandyV2
AndyPandyV2
Ya it sucks, the new C++ standard has enum class for doing this--at least that is something to look forward too.. I wrap all my enums in namespaces or structs to get around this annoyance.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.