Mail Archives: djgpp/1998/02/04/20:39:51
At 05:07 2/4/1998 +0200, S. M. Halloran wrote:
>>
>> Rylan wrote:
>> > > Is there anyway to free static variables under DJGPP when they have
>> > > outlived their usefulness?
>> >
>> > Of course not. If there were, this would mean you could *dynamically*
>> > change the size of that variable (to zero). But 'dynamic' is the exact
>> > contradiction of 'static'. Depending on the size of that variable,
>> > this is either no problem at all, or you should have used a dynamic
>> > variable in the first place.
>>
>> Sorry, stupid question. I wish to apologize to the group for wasting
>> its time.
As a somewhat interesting sidelight on this issue that has nothing to do
with the current discussion, this can be possible. K&R I has, as an example,
an implementation of `malloc' (which they call `alloc') and `free'. Since
the system works by keeping a free list, it is possible to add an arbitrary
region of memory (like a static array) to it. In fact, one of the exercises
is to write a routine (they call it `bfree') that does just that.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -