Re: C++


>>>>> "Andreas" == Andreas Kostyrka <> writes:

    Andreas> Exact the point. That's also one argument why gtk should
    Andreas> not get it's own GC, as language specific GC usually
    Andreas> poorly coexists with other GC in the same address space.

You can fudge it (which is why gnome-gtk exists at all), but generally 
I agree.  However...

    Andreas> Who needs garbage collections? Our destructors do all the
    Andreas> clear work. And WHO would want dynamic storage that lives
    Andreas> longer than the scope of the function, ... (I know about
    Andreas> ``SmartPtrs''. A really poor substitute and additionally,
    Andreas> potentially every library on the earth has it's own idea
    Andreas> of smartptrs -> the very least problem in this is that
    Andreas> understanding C++ code is getting a nightmare, ...)

I have difficulty believing that this isn't a troll, but let's try

- - tree/dag building [0]
- - databases
- - string and list processing [1]
- - GUIs [2]
- - file systems (really a special case of databases, but an important one)

I would actually go so far as to say that operations that don't need
dynamic storage that lives longer than the scope of the function are
in the minority (with certain exceptions, such as numerics, and
embedded programming).  There's a *reason* why malloc exists.

Now, not all of these need garbage collection.  Trees (although not
dags) can usually be handled with just destructors, some simple string 
and list operations can have simple enough memory semantics that it's
not much of an issue, etc.  But there is definitely a place for this.

Now, I agree that smart pointers aren't the way to go, but that's
largely because I believe real GC is the way to go.

[0] This is an enormous thing for compiler writers.  Even simple
    three-address code really requires this.
[1] Why do you think languages like SNOBOL and LISP were the first to
    have garbage collectors?
[2] Or do you really like building your entire GUI within the scope of 
    one function?
- -- 
Graham Hughes <>
PGP Fingerprint: 36 15 AD 83 6D 2F D8 DE  EC 87 86 8A A2 79 E7 E6

Version: 2.6.3ia
Charset: noconv
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface


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