trusted purity?

Walter Bright newshound2 at digitalmars.com
Mon Apr 29 13:51:51 PDT 2013


On 4/29/2013 1:03 PM, monarch_dodra wrote:
> On Monday, 29 April 2013 at 18:34:46 UTC, Walter Bright wrote:
>> On 4/29/2013 10:19 AM, monarch_dodra wrote:
>>> I'm getting strange behavior trying to cast to pure. This is my
>>> test program:
>>
>> You're casting a C function to a D function. This will cause crashes.
>
> OK, so say I have a documented pure C function, how do I call it from a pure
> scope? You say, take the address and cast it, but not if it's C...

extern (C) {
     int foo(int);
}

extern (C) {
     pure int function(int) fp_pure_t;
}

...
cast(fp_pure_t)(&foo)




More information about the Digitalmars-d mailing list