"subclassing" the watcher
Marc Lehmann
schmorp at schmorp.de
Tue Sep 16 01:51:55 CEST 2008
On Mon, Sep 15, 2008 at 08:42:51AM +0400, Kandalintsev Alexandre <exe at agava.com> wrote:
>> if you want that.
> Ok, but later in the documentation you cast "ev_io" to "my_io":
Yes I do, but that's fine, because there is a cast there.
Instead of specifying the address directly, you could also cast &my_io to
ev_io * or so - be creative, it's C.
> I think this is wrong becouse "w_" points to my_io->io and not to my_io,
> isn't it?
It's correct, because casting &my_io->io to struct my_io gives you the
address of &my_io in the example - read about how C layouts structures and
you will see why this works, and what to do in the cases when it doesn't
work (which is also exemplified in the same chapter).
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / pcg at goof.com
-=====/_/_//_/\_,_/ /_/\_\
More information about the libev
mailing list