Are function pointers compile time constants?

Nick Sabalausky a at a.a
Sun Feb 20 13:23:14 PST 2011


"Simon" <s.d.hammett at gmail.com> wrote in message 
news:ijrdif$1nn6$1 at digitalmars.com...
> 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.
>

I didn't know Windows did that, I thought it was just certain versions of 
Unix/Linux. Do you happen to know which version of Windows was first to have 
it? 




More information about the Digitalmars-d-learn mailing list