Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > enums and namespaces

Reply
Thread Tools

enums and namespaces

 
 
Vincent RICHOMME
Guest
Posts: n/a
 
      11-11-2006
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 ?


 
Reply With Quote
 
 
 
 
Ivan Vecerina
Guest
Posts: n/a
 
      11-11-2006
"Vincent RICHOMME" <(E-Mail Removed)> wrote in message
news:4555d387$0$14544$(E-Mail Removed)...
: 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
enums and bitfileds and signs Jason Kraftcheck C++ 2 11-16-2007 10:19 AM
Enums without identifier, enums and typedef =?utf-8?b?QXNiasO4cm4gU8OmYsO4?= C Programming 10 01-20-2007 01:20 AM
getEnclosingClass and enums ogmios01@gmail.com Java 0 02-27-2006 08:24 PM
SQL Storage, Enums, Roles and Clean Coding !!! Mr Newbie ASP .Net 10 11-22-2005 11:53 AM
enums in C and C++ Simon Elliott C++ 13 11-01-2004 10:26 AM



Advertisments