Are function pointers compile time constants?

Simon s.d.hammett at gmail.com
Sun Feb 20 07:53:26 PST 2011


On 20/02/2011 14:59, d coder wrote:
> Greetings
>
> I tried to initialize a struct member with a function pointer, and
> found that DMD2 did not like it. Are not function pointers compile
> time constants? And why they should not be?
>
> Regards
> - Cherry

No a function doesn't have an address until the .exe is loaded into 
memory. And with Address space randomisation on 'doze there is no 
reasonable way to make a function pointer a compile time value.

-- 
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk


More information about the Digitalmars-d-learn mailing list