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

Daniel P. Berrangé berrange at redhat.com
Tue Mar 9 18:29:45 UTC 2021


On Tue, Mar 09, 2021 at 07:23:15PM +0100, 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.
> 
> Note that I'm not talking just about humans either: some tooling also
> struggles a bit with the additional layer of indirection.

That's good to know. If developer tooling usage is being harmed that
significantly strengthens the case for removing them.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list