New iteration over the ev++ improvement patch.

Marc Lehmann schmorp at
Mon Jan 21 06:20:49 CET 2008

On Mon, Jan 21, 2008 at 03:02:54AM -0200, Leandro Lucarella <llucax at> wrote:
> > That would be a major bug in the compiler and/or linker? I doubt you will
> > find a compiler that buggy nowadays.
> GCC is that "buggy". But I don't think is a bug, because a variable has to

I tried it with g++-4.2 and g++-3.3 and both have no problems with it. ev.h
uses the same technique for global functions. It is required by the C++ and C
standards to work.

I don't know what makes you think it wouldn't work, or it shouldn't work.

> be addressable so it has to ocupy some space or at least point an unique
> fake address :)

Thats easily fulfillable, and besides, there is no such requirement in the
c++ (or C) standards.

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

> > Looks fine and sensible to me.
> Not bad, but we still have the link problem...

Which still doesn't exist? :)

> I don't think it does. At least my trivial testcase got the linking
> error with GCC.

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

> > > 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

*That* makes no sense whatsoever :)

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

More information about the libev mailing list