Structs defined by the Vulkan API use the sType
and pNext
members to enable assembling chains of structs. But some structs (e.g., VkDeviceCreateInfo
) declare pNext
as const void*
and other structs (e.g., VkPhysicalDeviceFeatures2
) declare it only as void*
. Is there any reason for the inconsistency? I couldn't find any mention in the spec of an intentional meaning behind the difference in constness, or any discussion of this online.
One of those structs is an input; the other is an output. VkPhysicalDeviceFeatures2
, and all of the structs in its pNext
linked list are for the API to write data into which you will read. It's not const
because it will be modified.
This is not "inconsistency"; it's const
-correctness.