Get address of overloaded function

BCS ao at pathlink.com
Mon Feb 26 15:31:45 PST 2007


Reply to Frank,

>> And now one of the classic proposals, once again.  :)
>> 
>> void* ptr = cast(void*) &fnc(int) ;
>> 
> Is this perhaps a problem with context free syntax?
> It is not clear, if this is a "get function pointer address" or a
> "call
> function" operation.
> void* ptr = cast(void*) &fnc( Something ) ;
> 
> To decide this, the compiler needs to have the arguments completely
> resolved. Then he can see if they are types, or not.
> 

The "address of" should resolve that because you can't take the address of 
a return. OTOH that would introduce L-value/R-value into the grammar. Maybe 
the syntax of a function call could allow a type list or an expression list 
(but not a mixed list) and then the semantics would sort it out later. Bahh, 
The more I think about this stuff the more I respect Walter.





More information about the Digitalmars-d mailing list