[FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.
Nicolas George
george at nsup.org
Wed Jul 1 18:13:22 EEST 2020
Anton Khirnov (12020-07-01):
> Why a template? It seems simpler to add a struct like
> typedef struct AVRefcount {
> atomic_uint refcount;
> void *opaque;
> void (*free)(void *opaque);
> } AVRefcount;
> and then embed it in everything that wants to be refcounted. All just
> normal structs and functions, no layers of macros.
Because what you propose requires an extra layer of pointers, which is
both annoying when reading and writing the code and inefficient when
running it.
Also because what you propose has void pointers, and therefore will not
benefit from the compiler checking the types at compilation time.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200701/8ea8d6d3/attachment.sig>
More information about the ffmpeg-devel
mailing list