Re: segfault w/ block, but not file scope



In article <slrnds3a4t.16s.random832@xxxxxxxxxxxxx>
Jordan Abel <random832@xxxxxxxxx> wrote:
>That's not "emulating pass by reference", that is passing by reference.
>The fact that the language doesn't have special syntax for it doesn't
>mean it's suddenly a different programming technique.

The phrase "programming technique" is a little bit slippery (in
much the same sense that an elephant is a little bit large :-) ).
C does not have garbage collection either, but you can "emulate"
it by replacing all operations of the form:

p = malloc(nbytes);
...
q = p;
...
q = r;
...
free(q);
...

with:

record_release(p); p = malloc(nbytes); record_ref(p);
...
record_release(q); q = p; record_ref(q);
...
record_release(q); q = r; record_ref(q);
...
record_release(q); free(q); q = NULL; /* for future record_release */

(make sure that p==NULL and q==NULL initially, of course).

If you do this, would you claim that C now "has" garbage collection?

You can emulate by-reference more easily than you can emulate
automatic garbage collection. Does the difficulty of emulation
play a role in deciding whether the language "has" the thing being
emulated?
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
.



Relevant Pages

  • Re: segfault w/ block, but not file scope
    ... >>> the value of a pointer to emulate pass by reference. ... >> mean it's suddenly a different programming technique. ... C neither supports nor does not support it, because it's not a language ...
    (comp.lang.c)
  • Re: Why C# and Java have got it wrong
    ... there are GC languages other than Java. ... > you used any language which conveniently supports higher order functions ... and I must apologize: garbage collection is ... > a reference to the proxy object living on the stack. ...
    (comp.programming)
  • resolving Wills misunderstanding
    ... You don't even need the Godel number of UTM ... If the proof works in a language that is equivalent to the instructions ... and you can tell a TM to emulate another TM's ...
    (comp.theory)
  • Re: Why C# and Java have got it wrong
    ... >>Leaks rdr. ... > rdr is not the object, it's a reference to the object. ... So your saying the language framework doesnt notice that rdr has the ... Or perhaps that breaks something else in garbage collection in general? ...
    (comp.programming)
  • Re: SoA Vs OO
    ... > I am somewhat familiar with the techniques, ... The technique I was proposing does *not* emulate OO. ... > your own language support. ... If the superclass is revised, it may acquire new machinery and hence new ...
    (comp.object)