|
-
August 28th, 2008, 11:04 AM
#1
void** in relation to QueryInterface??
The function prototype for QuerytInterface is this:
Code:
STDMETHODIMP QueryInterface( REFIID riid, void** pIFace )
And calling the QueryInterface function is like this:
Code:
pICreateCar->QueryInterface( IID_IStats, reinterpret_cast<void**>( &pIStats ) );
What's confusing me is the casting of the address of pIStats to void**
reinterpret_cast<void**>( &pIStats )
What exactly is void** in this context?? Why do we cast the address of the interface ptr to void**??
Thanks!
Last edited by SimplySane; August 28th, 2008 at 11:11 AM.
Reason: not yet done
-
August 28th, 2008, 11:38 AM
#2
Re: void** in relation to QueryInterface??
QueryInterface is used to get an interface pointer to any type of interface, so it makes sense to not have something specific for the secodn parameter isn't it ? Hence the choice of void** and not something like int** or IBlahBlah**
It's to make the compiler happy.
-
August 29th, 2008, 03:11 AM
#3
Re: void** in relation to QueryInterface??
What exactly is void** in this context??
In this context, and elsewhere, void** is a pointer to pointer to any type of POD/class/structure (not class member or something).
Best regards,
Igor
-
September 3rd, 2008, 11:00 AM
#4
Re: void** in relation to QueryInterface??
Yes, Igor is correct.
A void * is a pointer that can point at any data, therefore a void ** is a pointer to a void *. (Which defines it as Igor said - common sense)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|