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

Andrea Bolognani abologna at redhat.com
Tue Mar 9 18:23:15 UTC 2021


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.

Note that I'm not talking just about humans either: some tooling also
struggles a bit with the additional layer of indirection.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list