Thinking C ++ returns a result parameter and returns the result with a return value

/ * ** 
* xvkBuffer than writing as a parameter for the return value of the benefits are: 
* 1, xvkBuffer heap can be variable or stack variables, written as if the return value is the only application on the heap, because of the need to ensure its permanent 
* 2, xvkBuffer or as a return stack variables is clearly not, because it is not persistent 
* / 
void XVulkan :: CreateBuffer (VkBufferUsageFlagBits Usage, UINT size, OUT XVkBuffer & xvkBuffer) 
{ 
    VkBufferCreateInfo info = {}; 
    info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; 
    info. Usage = Usage; 
    info.size = size; 
    info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; 

    Auto RET = vkCreateBuffer (vkDevice, & info, NULL, & xvkBuffer.info.buffer);
    CheckResult (right); 


}

 

Guess you like

Origin www.cnblogs.com/timeObjserver/p/11314340.html