Category : Files from Magazines
Archive   : WDFEB92.ZIP
Filename : 3N02006A
#include
class Simple
{
public:
Simple *Next;
int SomeData;
void *operator new(size_t);
void operator delete(void *, size_t);
private:
enum {PERCHUNK = 128};
static Simple *FreeList;
};
void *Simple::operator new(size_t Size)
{
Simple *Free = FreeList;
if(Free)
FreeList = FreeList->Next;
else
{
Free = (Simple *)new char[PERCHUNK*sizeof(Simple)];
FreeList = Free;
for(int i = 1; i < PERCHUNK; ++i)
{
Free->Next = Free + 1;
++Free;
}
Free->Next = 0; // NULL terminator
Free = FreeList;
}
return Free;
}
void Simple::operator delete(void *Pointer, size_t)
{
Simple *This = (Simple *)Pointer;
This->Next = FreeList;
FreeList = This;
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/