Re: RFC: glocal - automatically freeing memory when it goes out of scope

On Thu, 05 Apr 2012 08:32:22 -0400 (EDT)
Alexander Larsson <alexl redhat com> wrote:
> 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.

This is apples and pears.  C++ constructors and destructors are
concerned with object lifetime, comparable to GObject's object
construction functions and finalizers.  Even the original CFront front
end for C with Classes provided them, as simple undecorated C functions
which it auto-generated with call code for the C compiler.  

gcc's constructor and destructor attributes as I understand them are
principally used in connection with the loading and unloading of
shared libraries at program start-up and close down, although I
imagine they have other uses.  If you say those may require OS support I
will believe you (certainly shared libraries do), and in terms of
ubiquity I do not dispute that their use and/or availability for C is
more widespread than, say, cleanup attributes.

My point only was that ubiquity is the issue, rather than a matter of
principle. Beyond that this is a non-issue which isn't worth taking any


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]