Connecting Tech Pros Worldwide Help | Site Map

What is an unqualified-id ?

  #1  
Old October 20th, 2006, 09:35 PM
DevNull
Guest
 
Posts: n/a
Hello,
I've searched and searched and cannot seem to figure it out so I was
hoping someone could explain to me exactly what an unqualified-id is?

My compiler is generating this error...
ThreadLibMutex.h:37: error: expected unqualified-id before ')'
token

My line 37 is the top of this constructor...

Mutex(){
#ifdef WIN32
// we use critical sections in Windows
InitializeCriticalSection( &m_mutex );
#else
pthread_mutex_init( &m_mutex, 0 );
#endif
}

The class itself is defined immediately above and consists of....

class Mutex {
protected:
// define the base mutex types
#ifdef WIN32
CRITICAL_SECTION m_mutex;
#else
pthread_mutex_t m_mutex;
#endif
public:
inline void Lock() {
#ifdef WIN32
EnterCriticalSection( &m_mutex );
#else
pthread_mutex_lock( &m_mutex );
#endif
}

inline void Unlock() {
#ifdef WIN32
LeaveCriticalSection( &m_mutex );
#else
pthread_mutex_unlock( &m_mutex );
#endif
}
}; // end class Mutex

I've just never heard of an unqualified-id so I have no idea whats
wrong, but the code is looking perfectly legal to me.
Any advice appreciated, and again, thanks in advance!
Regards,

  #2  
Old October 20th, 2006, 09:45 PM
Ron Natalie
Guest
 
Posts: n/a

re: What is an unqualified-id ?


DevNull wrote:
Quote:
Hello,
I've searched and searched and cannot seem to figure it out so I was
hoping someone could explain to me exactly what an unqualified-id is?
>
My compiler is generating this error...
ThreadLibMutex.h:37: error: expected unqualified-id before ')'
token
>
My line 37 is the top of this constructor...
>
Mutex(){]
I wouldn't be surprised if some Microsoft include file #define's
Mutex to be something.
  #3  
Old October 20th, 2006, 09:45 PM
Alf P. Steinbach
Guest
 
Posts: n/a

re: What is an unqualified-id ?


* DevNull:
Quote:
Hello,
I've searched and searched and cannot seem to figure it out so I was
hoping someone could explain to me exactly what an unqualified-id is?
>
My compiler is generating this error...
ThreadLibMutex.h:37: error: expected unqualified-id before ')'
token
>
My line 37 is the top of this constructor...
>
Mutex(){
#ifdef WIN32
// we use critical sections in Windows
InitializeCriticalSection( &m_mutex );
#else
pthread_mutex_init( &m_mutex, 0 );
#endif
}
>
What Ron Natalie said (look out! Microsoft macros everywhere! or, as Dan
Quayle would have said, Microsoft macroes everywhere!), plus, try using
the qualified id

Mutex::Mutex()

;-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
  #4  
Old October 20th, 2006, 09:55 PM
DevNull
Guest
 
Posts: n/a

re: What is an unqualified-id ?



<snip>
Quote:
What Ron Natalie said (look out! Microsoft macros everywhere! or, as Dan
Quayle would have said, Microsoft macroes everywhere!), plus, try using
the qualified id
>
Mutex::Mutex()
>
;-)
</snip>

Nope that made things worse...
ThreadLibMutex.h:35: error: definition of implicitly-declared
'Mutex::Mutex()'
ThreadLibMutex.h:35: error: declaration of 'Mutex::Mutex()' throws
different exceptions
ThreadLibMutex.h:9: error: than previous declaration 'Mutex::Mutex()
throw ()'

Line 9 being where the Mutex class is located. Oh and ya can't blame
this one on MS, I'm compiling this code with GCC v4.0.3 it's just
supposed to be a simple little crossplatform wrapper :( If anyone is
interested I can post the complete source. It's only 49 lines of code
in total.

  #5  
Old October 20th, 2006, 10:15 PM
Ron Natalie
Guest
 
Posts: n/a

re: What is an unqualified-id ?


DevNull wrote:
Quote:
<snip>
Quote:
>What Ron Natalie said (look out! Microsoft macros everywhere! or, as Dan
>Quayle would have said, Microsoft macroes everywhere!), plus, try using
>the qualified id
>>
> Mutex::Mutex()
>>
>;-)
</snip>\
Try sticking #undef Mutex
right before the affected line.

A unqualified id is one without :: in it.

Nothing inside a class definition should have a qualification.
  #6  
Old October 20th, 2006, 10:25 PM
Michael
Guest
 
Posts: n/a

re: What is an unqualified-id ?


Quote:
Nope that made things worse...
ThreadLibMutex.h:35: error: definition of implicitly-declared
'Mutex::Mutex()'
ThreadLibMutex.h:35: error: declaration of 'Mutex::Mutex()' throws
different exceptions
ThreadLibMutex.h:9: error: than previous declaration 'Mutex::Mutex()
throw ()'
Listen to your compiler, not the MS bashers.

Declare the constructor in your class definition. . .

Michael

  #7  
Old October 20th, 2006, 10:35 PM
DevNull
Guest
 
Posts: n/a

re: What is an unqualified-id ?


Awesome!
<snip>
Quote:
Declare the constructor in your class definition. . .
</snip>
Ahhh thank you!
I got it working now.

  #8  
Old October 20th, 2006, 11:05 PM
Rolf Magnus
Guest
 
Posts: n/a

re: What is an unqualified-id ?


DevNull wrote:
Quote:
If anyone is interested I can post the complete source. It's only 49
lines of code in total.
I'd say that would be a great idea.


  #9  
Old October 21st, 2006, 12:15 AM
Alf P. Steinbach
Guest
 
Posts: n/a

re: What is an unqualified-id ?


* DevNull:
Quote:
<snip>
Quote:
>What Ron Natalie said (look out! Microsoft macros everywhere! or, as Dan
>Quayle would have said, Microsoft macroes everywhere!), plus, try using
>the qualified id
>>
> Mutex::Mutex()
>>
>;-)
</snip>
>
Nope that made things worse...
ThreadLibMutex.h:35: error: definition of implicitly-declared
'Mutex::Mutex()'
You also need to /declare/ the constructor in the class definition.

Hth.,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is an unqualified pointer in C? suresh gani answers 4 August 8th, 2007 01:48 PM
Is an address change possible by "deconstify/const_cast"? Markus.Elfring@web.de answers 11 November 15th, 2005 12:31 AM
Is an address change possible by "deconstify/const_cast"? Markus.Elfring@web.de answers 12 July 23rd, 2005 06:53 AM
string literal is an lvalue; other literals are rvalues. Steven T. Hatton answers 11 July 22nd, 2005 10:53 AM
string literal is an lvalue; other literals are rvalues. Steven T. Hatton answers 9 July 22nd, 2005 09:52 AM