Cannot check function address

Steven Schveighoffer schveiguy at gmail.com
Wed May 25 04:34:43 UTC 2022


On 5/25/22 12:16 AM, frame wrote:
> On Wednesday, 25 May 2022 at 03:41:17 UTC, Steven Schveighoffer wrote:
> 
>> This is a compiler bug, at least I think so. Since the compiler is 
>> misbehaving, it's not clear how to make it behave.
>>
>> -Steve
> 
> Well, ok, it's not my top priority and dustmite seems to run better on 
> Unix - which I need to port anyway some time but not now.
> 
> But it must be possible to check if the function pointer is valid in 
> Assembler? But I'm not familiar with asm to do it correctly - I would be 
> very appreciative if someone could post an example how to do it in D.
> 
> So far, thank you for your time.

Well, you can possibly work around the type system, but I don't know 
what the compiler thinks you have there.

```d
assert(*(cast(void**)&fun) !is null);
```

-Steve


More information about the Digitalmars-d-learn mailing list