On Tue, Aug 14, 2012 at 08:24:08AM -0400, Dmitri Pal wrote:
On 08/14/2012 04:54 AM, Ondrej Kos wrote:
> Nack
>
> Working, but hard to read, use typedef for those strcmp casts.
Ondrej's explanation on list was quite short, more details were provided in
person, along with a reminder that the explanation needs to be more
verbose next time so that it's easily consumable just by following the
list.
As per the typedefs, we forbid the use of typedefs for data types, which
would obscure the real type underneath. However, the patch used a
pointer to a function to provide a generic comparison mechanism.
When using a function pointer, we use typedefs, copying the full
function header would be ugly.
Something like:
typedef int (*cmp_fn)(void *, void *);
Is allowed, because consumers of the compare functions can use it quite
easily:
int do_compare(void *p1, void *p2, cmp_fn fn);
I think our coding style needs to me amended to explicitly state that we
only forbid typedefs when declaring data types.