Cannot implicitly convert delegate to function

Jarrett Billingsley kb3ctd2 at yahoo.com
Thu Apr 27 07:54:22 PDT 2006


"Lionello Lunesu" <lio at lunesu.remove.com> wrote in message 
news:e2qig4$1ovk$1 at digitaldaemon.com...
> Hi,
>
> Shouldn't a (pointer to a) function be convertible to a delegate? Seems to 
> me it's like casting an int to a long; the latter has "more info" and can 
> be converted back into the former without the loss of data. The same holds 
> for function/delegate: a function could be converted to a delegate for 
> "null"; by forgetting the "this" (null), we get the function pointer back.

Without the context pointer, a delegate cannot function properly.  So 
casting from delegate to function isn't really possible.

The other way around.. I don't think so either.  Something tells me the 
mechanism for a delegate call would screw up if the context pointer were 
null, or if the function weren't designed to be a delegate. 





More information about the Digitalmars-d-learn mailing list