purity question

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 30 04:34:52 PDT 2017


Rene Zwanenburg wrote:

> On Monday, 29 May 2017 at 01:36:24 UTC, Jonathan M Davis wrote:
>>> A simple example: anything that has a malloc/free pair.
>>
>> Yeah, if you do it right, you should be fine, but you have to do it 
>> right, and it's very easy to miss some detail that makes it wrong to 
>> insist to the compiler that what you're doing is pure.
>
> If malloc were marked as pure, wouldn't that mean it must return the same 
> pointer every time you call it with the same size?

of course. but D "pure" is not what other world knows as "pure". we love to 
mess with words.


More information about the Digitalmars-d-learn mailing list