| View previous topic :: View next topic |
| Author |
Message |
Menny Guest
|
Posted: Wed Sep 28, 2005 2:53 pm Post subject: error C2664 with InterlockedExchangePointer |
|
|
I'm moving from VC6 to VC2003 and from multi-byte to Unicode.
After fixing all the errors related to unicode, i ended with an error i
can not resolve.
************
error C2664: 'InterlockedExchangePointer' : cannot convert parameter 1
from 'T ** ' to 'void ** '
with
[
T=MyClass
]
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
********************
The code is:
***************
MyClass * mQ_waiting_for_write;
InterlockedExchangePointer(&mQ_waiting_for_write, NULL);
**************
Any ideas what is the problem?
|
|
| Back to top |
|
 |
myporter@gmail.com Guest
|
Posted: Wed Sep 28, 2005 3:17 pm Post subject: Re: error C2664 with InterlockedExchangePointer |
|
|
may be you can try this:
InterlockedExchangePointer((void**)(&mQ_waiting_for_write,NULL);
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Wed Sep 28, 2005 3:20 pm Post subject: Re: error C2664 with InterlockedExchangePointer |
|
|
Menny wrote:
| Quote: | I'm moving from VC6 to VC2003 and from multi-byte to Unicode.
After fixing all the errors related to unicode, i ended with an error i
can not resolve.
************
error C2664: 'InterlockedExchangePointer' : cannot convert parameter 1
from 'T ** ' to 'void ** '
with
[
T=MyClass
]
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
********************
The code is:
***************
MyClass * mQ_waiting_for_write;
InterlockedExchangePointer(&mQ_waiting_for_write, NULL);
**************
Any ideas what is the problem?
|
The problem is that the address of a pointer to MyClass cannot be
converted to a pointer to a pointer to void. That's what the compiler
is telling you.
Since 'InterlockedExchangePointer' is not a standard function, you need
to look in its manual for the suggested uses. Or post to a newsgroup
where that function is on topic.
V
|
|
| Back to top |
|
 |
mlimber Guest
|
Posted: Wed Sep 28, 2005 3:22 pm Post subject: Re: error C2664 with InterlockedExchangePointer |
|
|
Menny wrote:
| Quote: | I'm moving from VC6 to VC2003 and from multi-byte to Unicode.
After fixing all the errors related to unicode, i ended with an error i
can not resolve.
************
error C2664: 'InterlockedExchangePointer' : cannot convert parameter 1
from 'T ** ' to 'void ** '
with
[
T=MyClass
]
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
********************
The code is:
***************
MyClass * mQ_waiting_for_write;
InterlockedExchangePointer(&mQ_waiting_for_write, NULL);
**************
Any ideas what is the problem?
|
It would be more apropos to post this on microsoft.public.vc.language
or similar. This forum is for standard C++, and
InterlockedExchangePointer isn't standard.
Cheers! --M
|
|
| Back to top |
|
 |
mlimber Guest
|
Posted: Wed Sep 28, 2005 3:23 pm Post subject: Re: error C2664 with InterlockedExchangePointer |
|
|
mypor... (AT) gmail (DOT) com wrote:
| Quote: | may be you can try this:
InterlockedExchangePointer((void**)(&mQ_waiting_for_write,NULL);
|
Better to use reinterpret_cast to flag the potentially non-portable
conversion.
Cheers! --M
|
|
| Back to top |
|
 |
|