C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

error C2664 with InterlockedExchangePointer

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Menny
Guest





PostPosted: Wed Sep 28, 2005 2:53 pm    Post subject: error C2664 with InterlockedExchangePointer Reply with 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?

Back to top
myporter@gmail.com
Guest





PostPosted: Wed Sep 28, 2005 3:17 pm    Post subject: Re: error C2664 with InterlockedExchangePointer Reply with quote



may be you can try this:
InterlockedExchangePointer((void**)(&mQ_waiting_for_write,NULL);

Back to top
Victor Bazarov
Guest





PostPosted: Wed Sep 28, 2005 3:20 pm    Post subject: Re: error C2664 with InterlockedExchangePointer Reply with quote



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





PostPosted: Wed Sep 28, 2005 3:22 pm    Post subject: Re: error C2664 with InterlockedExchangePointer Reply with quote


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





PostPosted: Wed Sep 28, 2005 3:23 pm    Post subject: Re: error C2664 with InterlockedExchangePointer Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.