Skip to main content
deleted 8 characters in body; edited title
Source Link
user1430
user1430

casting directx Why and how should I cast DirectX function parameterparameters?

I'm learning DX11 and I found that in some D3D functions, a parameter has to be cast just like in the GetBuffer function of the swapChain: the third parameter has to be of type void**, so when calling this function the conversion is done just writing (void**) before, a C conversion if I'm not wrong. 

But in other functions with a pointer like type** (where type IS NOT void) is used the reinterpret_cast. I wanted to know if the difference is because of the void type respect to the other types and, if it's not because of the void type, when should I use (type**) and when should I use reinterpret_cast.

Thanks.

casting directx function parameter

I'm learning DX11 and I found that in some D3D functions, a parameter has to be cast just like in the GetBuffer function of the swapChain: the third parameter has to be of type void**, so when calling this function the conversion is done just writing (void**) before, a C conversion if I'm not wrong. But in other functions with a pointer like type** (where type IS NOT void) is used the reinterpret_cast. I wanted to know if the difference is because of the void type respect to the other types and, if it's not because of the void type, when should I use (type**) and when should I use reinterpret_cast.

Thanks.

Why and how should I cast DirectX function parameters?

I'm learning DX11 and I found that in some D3D functions, a parameter has to be cast just like in the GetBuffer function of the swapChain: the third parameter has to be of type void**, so when calling this function the conversion is done just writing (void**) before, a C conversion if I'm not wrong. 

But in other functions with a pointer like type** (where type IS NOT void) is used the reinterpret_cast. I wanted to know if the difference is because of the void type respect to the other types and, if it's not because of the void type, when should I use (type**) and when should I use reinterpret_cast.

Source Link
German
  • 181
  • 1
  • 6

casting directx function parameter

I'm learning DX11 and I found that in some D3D functions, a parameter has to be cast just like in the GetBuffer function of the swapChain: the third parameter has to be of type void**, so when calling this function the conversion is done just writing (void**) before, a C conversion if I'm not wrong. But in other functions with a pointer like type** (where type IS NOT void) is used the reinterpret_cast. I wanted to know if the difference is because of the void type respect to the other types and, if it's not because of the void type, when should I use (type**) and when should I use reinterpret_cast.

Thanks.