Disable GC entirely

Minas Mina minas_mina1990 at hotmail.co.uk
Mon Apr 8 08:16:07 PDT 2013


Sorry, if it wasn't clear. I was talking about C++.

Even if you are not mixing the two, you can still get f*** up.

struct S
{
	S()
	{
		cout << "S()\n";
	}
};

int main()
{
	S *s = new S(); // constructor is called
	
	S *s2 = (S*)malloc(sizeof(S)); // constructor is NOT called
}

So you see an innocent struct type and you decide to use malloc 
instead of new... If it has a constructor/destructor/... those 
will not be called. It's just asking for trouble.


More information about the Digitalmars-d mailing list