----- Original Message ----- > On Tue, 03 Apr 2012 23:35:46 -0400 > Colin Walters <walt...@verbum.org> wrote: > > On Wed, 2011-11-16 at 21:05 +0100, Mikkel Kamstrup Erlandsen wrote: > > > Hi all, > > > > > > I have been looking at gcc's "cleanup" attribute[1] that allows > > > one > > > to specify a callback that will be invoked when a variable goes > > > out > > > of scope. This allows one to play with automatically freeing > > > resources. > > > > So this is frankly pretty cool - but we can't make GLib/GTK+ > > dependent on GNU C. > > I guess that for glib these things are matters of degree rather than > principle. glib now uses gcc's constructor and destructor attributes > since, I think, version 2.32 (I believe that is when gconstructor.h > first appeared), presumably on the grounds that, although > non-standard, > they are also found in most mainstream compilers likely to be used > with glib.
What it uses is constructors, not particularly the gcc ones (although they are used with gcc). On MSVC and SunCC we use the native compiler methods to create constructors and destructors. Constructors are a required feature of C++ and all OSes that want to support C++ have to somehow handle them, and its also pretty common for C code to use them. So, I don't think its comparable at all to something that is specific to gcc only. _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list