_Letters to the Editor_

by Poul A. Costinsky 

class Foo
{
public:
        Foo();
        ~Foo();
}
// allocation
Foo* pBar = (Foo *)malloc(10*sizeof(Foo));
// construction
for (i = 0; i< 10; i++)
        (pBar + i)->Foo::Foo();
// reallocation
pBar = (Foo *)realloc(pBar, 11*sizeof(Foo));
// construction of additional element
(pBar + 10)->Foo::Foo();
// destruction and deallocation
for (i = 0; i< 11; i++)
        (pBar + i)->Foo::~Foo();
free(pBar);

by Edward Sitarski 

 ...
class DoublyLinkedList
{
public:
	DoublyLinkedList()
	{
		head = tail = &sentinal;
	}
	// The next line will no longer work after realloc
	// byte copies this object!
	bool isEmpty() const { return head == &sentinal; }
	...
private:
	DoublyLinkedElement	sentinal;
	DoublyLinkedElement	*head, *tail;
	...
};
  ...

