New iteration over the ev++ improvement patch.

Marc Lehmann schmorp at
Tue Jan 22 19:13:19 CET 2008

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 ().

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.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list