On Thu, 2007-02-22 at 20:00 +0000, Daniel P. Berrange wrote: > On Sat, Feb 17, 2007 at 01:58:04PM +0000, Richard W.M. Jones wrote: > > > > Would anyone object to a patch using __attribute__((constructor)) > > throughout libvirt rather than all this if(!initialised) initialise() stuff? > > I don't think that annotation is widely supported enough by constructors > for us to be able to use it - in particular I think it'd be a problem for > the Solaris guys using libvirt unless they switched to GCC instead of the > Sun compilers/linkers. A better reason[1], IMHO is that it just makes code more obtuse for little gain - e.g. what order are they called in? And you'd have weird stuff where the handler set by virSetErrorFunc() would not be called if an error occurred in a constructor, requiring the library user to also use a constructor in order to call virSetErrorFunc() ... Cheers, Mark. [1] - Because I wouldn't be surprised if forte does actually support it