RFC: do we want/need the "Ptr" typedefs for internal code ?

Laine Stump laine at redhat.com
Wed Mar 10 05:17:16 UTC 2021


On 3/9/21 1:23 PM, Andrea Bolognani wrote:
> On Tue, 2021-03-09 at 17:44 +0000, Daniel P. Berrangé wrote:
>> One of the conventions we have had since the early days of libvirt is
>> that every struct typedef, has a corresponding "Ptr" typedef too.
>>
>> For example
>>
>>      typedef struct _virDomainDef virDomainDef;
>>      typedef virDomainDef *virDomainDefPtr;
>>
>> Periodically someone has questioned what the purpose of these Ptr
>> typedefs is, and we've not had an compelling answer, other than
>> that's what we've always done.
>>
> [...]
>>
>> Does anyone have suggestions for how these "Ptr" typedefs are
>> benefiting libvirt ? Would anyone miss them ?
> 
> I consider them pointless obfuscation and would love to see them go.

Yep. I've never seen the point either (especially after we realized the 
problem with const pointers several years ago); I just followed along 
blindly because that was the convention and I figured *someone* must 
have a special place in  their heart for them. I wouldn't bat an eye if 
they were removed.




More information about the libvir-list mailing list