OT: typesafe callbacks in C (Re: [WIP PATCH 1/7] Add skeleton RA svnclient)
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jun 25, 2010, 15:30 UTC
- Message-ID
- <20100625153031.GA9702@burratino>
- In-Reply-To
- <alpine.561.2.00.1006251412170.2144@daniel2.local>
Daniel Shahaf wrote:
Show 12 quoted lines
> By the way, a common pitfall is to mis-treat the void *baton argument as
> the wrong type of baton. That is, code of the form
>
> f(void *baton) {
> foo_baton_t *fb = baton;
> }
>
> instead of
>
> f(void *baton) {
> bar_baton_t *bb = baton;
> }Just for kicks, I should mention
http://ccan.ozlabs.org/info/typesafe_cb.html
which makes code like this cause warnings with gcc.
Maybe some version of Subversion years from now could use it.