[FFmpeg-devel] [PATCH 1/4] lavu: add simple array implementation

Michael Niedermayer michaelni at gmx.at
Wed Mar 5 00:03:39 CET 2014


On Tue, Mar 04, 2014 at 11:24:50PM +0100, Nicolas George wrote:
> Le quartidi 14 ventôse, an CCXXII, Lukasz Marek a écrit :
> > >From 6cdb1cb4b846478c8d7bc3c44e9e5d474aca52e0 Mon Sep 17 00:00:00 2001
> > From: Lukasz Marek <lukasz.m.luki at gmail.com>
> > Date: Tue, 25 Feb 2014 01:06:06 +0100
> > Subject: [PATCH 1/4] lavu/mem: add av_dynarray_add_nofree function
> > 
> > av_dynarray_add_nofree function have similar functionality
> > as existing av_dynarray_add, but it doesn't deallocate memory
> > on fails.
> 
> I am sorry, but I still do not like it very much. It fixes one of the flaws
> of av_dynarray_add(), but there are still others: you can not choose the
> element size (this is only in the 2 variant; this version is even worse: it
> assumes that sizeof(void *) == sizeof(intptr_t)),


> you can not choose the
> type for the size variable (at some places, it is convenient to be able to
> use size_t).

are you sure that you arent overdesigning this ?


> 
> I still think that a macro is a better solution.

macros can confuse the "user", especially these kind of smart macros
that do tricks that C functions couldnt


also the compiler
tends to produce more cryptic error messages when there are mistakes
in macro use than when there are mistakes in function use.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140305/4b030eca/attachment.asc>


More information about the ffmpeg-devel mailing list