Re: segfault w/ block, but not file scope
- From: Chris Torek <nospam@xxxxxxxxx>
- Date: 9 Jan 2006 02:18:32 GMT
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.
.
- References:
- Re: segfault w/ block, but not file scope
- From: Keith Thompson
- Re: segfault w/ block, but not file scope
- From: Joseph Dionne
- Re: segfault w/ block, but not file scope
- From: Mark McIntyre
- Re: segfault w/ block, but not file scope
- From: Jordan Abel
- Re: segfault w/ block, but not file scope
- Prev by Date: [OT] Re: Char* to Char*
- Next by Date: Re: realloc question
- Previous by thread: Re: segfault w/ block, but not file scope
- Next by thread: Re: segfault w/ block, but not file scope
- Index(es):
Relevant Pages
|