By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,605 Members | 1,483 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,605 IT Pros & Developers. It's quick & easy.

enums and namespaces

P: n/a
Hi,

some questions about namespaces.
Let's say I have a class CExtPaintManager defined like this :

class CExtPaintManager
{
protected:
....

class B
{

};
public:
class C
{

};

enum e_align_t
{
__ALIGN_HORIZ_CENTER = 1,
__ALIGN_HORIZ_RIGHT = 2,
__ALIGN_VERT = 4
};

};

When I compile my sample code compiler says :
warning C4482: nonstandard extension used: enum
'CExtPaintManager::e_align_t' used in qualified name

m_nAlign = CExtPaintManager::e_align_t::__ALIGN_HORIZ_CENTER
|CExtPaintManager::e_align_t::__ALIGN_VERT;
What does it mean and how fix it ?
Nov 11 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Vincent RICHOMME" <ri******@free.frwrote in message
news:45***********************@news.free.fr...
: class CExtPaintManager
: {
....
:
: enum e_align_t
: {
: __ALIGN_HORIZ_CENTER = 1,
: __ALIGN_HORIZ_RIGHT = 2,
: __ALIGN_VERT = 4
: };
:
: };
:
: When I compile my sample code compiler says :
: warning C4482: nonstandard extension used: enum
: 'CExtPaintManager::e_align_t' used in qualified name
:
: m_nAlign = CExtPaintManager::e_align_t::__ALIGN_HORIZ_CENTER
: |CExtPaintManager::e_align_t::__ALIGN_VERT;
: What does it mean and how fix it ?

In standard C++, enumeration constants are accessible
within the scope that contains the enum. The enum itself
does not define a scope. So you should write:
m_nAlign = CExtPaintManager::__ALIGN_HORIZ_CENTER
| CExtPaintManager::__ALIGN_VERT;

Another issue in the code example you posted is that
it is illegal for a standard-conformant C++ program
to use identifiers that contain two underscores,
or to use (most) identifiers that start with an underscore.
-Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form

Nov 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.