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