New iteration over the ev++ improvement patch.

Leandro Lucarella llucax at
Wed Jan 23 00:24:16 CET 2008

Marc Lehmann, el 22 de enero a las 19:13 me escribiste:
> On Tue, Jan 22, 2008 at 03:03:16PM -0200, Leandro Lucarella <llucax at> wrote:
> > >    ev::io myw(ev::default_loop);
> > > 
> > > would be fine. My proposal does just that without static initialisation.
> > 
> > What if I want to initialize it with some arguments?
> That is not the purpose of the global default loop: If you want special
> initialisation, call e.g. ev::default_init ().

Damn! That was what I wanted in the first place but you didn't liked the
init stuff! :S

I guess we're having comunication problems, I done, undone and redone
everything twice or more :S

> the purpose of the default_loop objetc is to provide the default loop,
> not to initialise it to something specific. It is for _using_ the default
> loop, not for _configuring_ it.
> > So you can use it like:
> > 
> >     ev::loop loop = ev::default_loop (ev::NOFLAGS);
> that would work just as well, although I wouldn't provide that, because
> then users mightr expect to actually get a default loop speciified by the
> flags, which is not the case. "ev::defaut_loop" makes it clear that you
> get whatever is the current default loop.
> > But I think it's a little obscure and the only gain is avoid typing "()",
> > which will be only necessary once in most cases (because you'll use the
> > loop only once in that scope or because you'll store it in a local loop
> > variable).
> Well, its all a matter of abstraction. I would vastly prefer the variable
> form because thats what I would expect, but feel free to overrule me here.

I prefered the variable (the complete one, with all the methods) too, but
you complained about it. If you want to have the variable, I'd like to
provide it as a full loop object as in here[1], so all methods can be
called (I can move init() and destroy() as free functions called
default_init() and default_destroy() if you want).

Doing your anonymous struct trick is the same to provide just a ev_loop


Leandro Lucarella (luca) | Blog colectivo:
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
Sometimes you got to suffer a little in your youth to motivate you to
succeed later in life. Do you think if Bill Gates got laid in high
school, do you think there'd be a Microsoft? Of course not. You gotta
spend a lot of time stuffin your own locker with your underwear wedged
up your arse before you think "I'm gona take over the world with
computers! You'll see I'll show them."

More information about the libev mailing list