New iteration over the ev++ improvement patch.

Leandro Lucarella llucax at gmail.com
Mon Jan 21 14:30:25 CET 2008


Marc Lehmann, el 21 de enero a las 06:20 me escribiste:
> > > Let's wait for c++0x and lets overwrite the . operator then. Or override
> > > the -> operator now:
> > > 
> > >   ev_io myio (ev::default_loop);
> > >   myio.start (...);
> > >   ev::default_loop->run ();
> > 
> > It looks like you want me to rename loop() to run() =P
> 
> "Want" is the wrong word, but it would enbale us to use struct loop in place
> of struct loop_ref.

But it will forbids us to use the name loop for the watcher's variable.

> > I don't think it does. At least my trivial testcase got the linking
> > error with GCC.
> 
> http://ue.tst.eu/3bb204f88a49475421615172f2ea7516.txt
> 
> I would really be interested in your trivial case and the linking error you
> get. static variables *must* not collide, they are private to the translation
> unit.

Ups! I didn't saw the magic word static :)

I don't think it's that nice to compulsively add a variable to each
translation unit, but since it doesn't take any space is not that bad.

> > > > We should provide an initialization method for the default loop and make
> > > > the default constructor a NOP though.
> > > 
> > > The problem with thta is that you have no control over construction order
> > > and flags.
> > 
> > If we do what I said in the above paragraph, you have.
> 
> Oh, you mena, users will have to call ev_default_init themselves? Do you
> think any user who knows what she is doing will prefer your method over a
> straightforward declaration of their own default loop pointe r(which saves
> typing).
> 
> *That* makes no sense whatsoever :)

I find more natural to do (in C++):
ev::default_loop->init (flags);
than:
ev_default_init (flags);

And BTW, why ev_default_init () and not ev_default_loop ()?

I'm a little lost now... :)

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Que importante, entonces en estos días de globalización refregar
nuestras almas, pasarle el lampazo a nuestros corazones para alcanzar
un verdadero estado de babia peperianal.
	-- Peperino Pómoro




More information about the libev mailing list