Is this function pure?

Janice Caron caron800 at googlemail.com
Tue Sep 18 05:36:50 PDT 2007


Is this function pure?

int probablyNotPure(int x)
{
	try
	{
		char[] a = new char[x];
		return a.length;
	}
	catch
	{
		return 0;
	}
}

I must assume not, since it's not deterministic. But which part of it
wrong? Should "new" be forbidden? Or is "try/catch"? Or both?



More information about the Digitalmars-d mailing list