Marc Lehmann, el 20 de enero a las 16:49 me escribiste: > > I would say to make a macro: > > #define loop default_loop () > > but they don't go too well with namespaces :S > > Now, you give me ideas, one could of course... > > static struct > { > operator loop_ref () { return ...; } > } default_loop; > > would be interesting to see what kinds of overhead this creates, if any.
I don't think it's going to work. Even if that struct takes no space, you get a multiple definition error when linking multiple translation units. And then, it would be useful only for passing arround since to call any methods you'll have to do something like ev::loop_ref(ev::default_loop).method(); But it would be so nice if we can sort out a way to use the default_loop as an object. One way to do that would be to include the default_loop alocation in the libev.so, compiling in some ev++.cpp which consist in just in: #include "ev++.h" ev::default_loop; Maybe it's not that much overhead for C uses after all. We should provide an initialization method for the default loop and make the default constructor a NOP though. -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- Sometimes I think the sure sign that life exists elsewhere in the universe Is that that none of them tried to contact us _______________________________________________ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev