Jump to content
  • Advertisement
Sign in to follow this  
sheep19

Is this non-standard?

This topic is 3628 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Consider this class:
Class img
{
public:
enum DIRECTION {TO_ZERO, TO_INFINITY};
};

//in main

img ball;
//VC++ says it's not standard and gives a warning.
ball.setDirectionY(Sprite::DIRECTION::TO_INFINITY);

How can I make so I don't get the warning?

Share this post


Link to post
Share on other sites
Advertisement
Have a look here on how to use enums inside classes:
http://msdn.microsoft.com/en-us/library/2dzy4k6e(VS.71).aspx

Share this post


Link to post
Share on other sites
Quote:
Original post by Dave
What is the exact warning


warning C4482: nonstandard extension used: enum 'Sprite::DIRECTION' used in qualified name

Share this post


Link to post
Share on other sites
Quote:
Original post by Dave
Have yo googled for that error code?


Just now :)


// C4482.cpp
// compile with: /c /W1
struct S {
enum E { a };
};

int i = S::E::a; // C4482
int j = S::a; // OK


Thanks!

Share this post


Link to post
Share on other sites
When posing code please post valid code not code which you have just made up. You are using a class/namespace name Sprite yet the enumeration is in the namespace img. To use in the current standard you would use

img::TO_ZERO


IIRC the next standard changes this and requires the enum tag to allow for enumeration values in the same namespace(not enum namespace) yet different enum namespace to have the same name.
for example
struct Foo
{
enum bar{something};
enum baz{something};
};
[/source]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!