bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pipe-filter: nice work


From: Bruno Haible
Subject: Re: pipe-filter: nice work
Date: Sat, 23 Jul 2011 23:19:13 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Hi Reuben,

> it gives me confidence a) because the code is from gnulib

Well, what gives me confidence is not the mere fact that it's from gnulib,
but that it has a unit test that was verified to pass on all kinds of
platforms.

> The only inelegance is having
> to code up a struct type to pass around the privdata argument even for
> something as simple as passing data in and reading it out again.

That's life, in C. A callback consists of a function pointer plus a privdata
pointer, which is declared as 'void *' but actually some specialized pointer.
C's type system does not have co-variant and contra-variant inference logic [1],
therefore you have to cast this privdata argument manually.

Bruno

[1] 
http://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)
-- 
In memoriam Adam Czerniaków <http://en.wikipedia.org/wiki/Adam_Czerniaków>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]