Cannot check function address
frame
frame86 at live.com
Wed May 25 19:00:14 UTC 2022
On Wednesday, 25 May 2022 at 14:09:31 UTC, Steven Schveighoffer
wrote:
> Yes, he acknowledged that too much was stripped. I also
> verified similar code works.
>
> But the real problem was something else. He is saying in this
> message "why doesn't the compiler recognize that in comparing a
> function to null, I really wanted to compare a function
> *pointer* to null", but I don't see how the compiler can make
> that leap.
>
> Often times, I wish the compiler could just read what I was
> thinking when I wrote the code, so it could give me
> thought-contextual errors but alas, it can't.
>
> -Steve
The real problem was that I was locking my mind that the `fun`
symbol was unique. In fact it was not. There was another code
version where the `fun` symbol was declared as exported function
and some import did read that code. My code was not affected from
this bug since the call syntax for function and function pointer
was the same. And I honestly never noticed that the compiler may
says 'function' or 'function pointer'. It was always the same to
me.
I should have test it with `__traits(getLocation)` before.
More information about the Digitalmars-d-learn
mailing list