pure or not pure?
Koroskin Denis
2korden+dmd at gmail.com
Thu Apr 10 10:23:18 PDT 2008
On Thu, 10 Apr 2008 20:34:29 +0400, Janice Caron <caron800 at googlemail.com>
wrote:
> On 10/04/2008, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>
>> char[] c = new char[5];
>>
>> is invalid inside a pure function because the compiler cannot verify
>> uniqueness of mutable heap data, right?
>
> No. As I said, new is special. It's integral to the language.
OK, new is 'special', but what about malloc or my own allocator? (I happen
to work in a gamedev and we never use new nor malloc).
I don't see how
special extern(C) void* malloc(size_t size);
differs from:
void* my_malloc(size_t size)
{
return malloc(size);
}
and why can't it be 'special' too.
More information about the Digitalmars-d
mailing list