Is the address-of operator (&) really needed?

Sandeep Datta datta.sandeep at gmail.com
Thu May 31 03:25:20 PDT 2012


>   //fptr = handleRequest; // will not work, because it is 
> "understdood"
> as:
>                           // fptr = handleRequest();
>

But do we really need this feature? Typing () does not seem to be 
too much work besides we can use properties if we really need to 
drop the brackets. And given the fact that properties have well 
understood use cases (see 
http://msdn.microsoft.com/en-us/library/bzwdh01d(VS.71).aspx#cpconpropertyusageguidelinesanchor1) 
I am not sure using functions as properties is such a good idea.

>   fptr = &handleRequest;  // This will work if we have only one
> handleRequest();
>                           // If you uncomment the first one, 
> you are in
> trouble

Can't we use auto-inferencing here to select the right method 
since fptr has the required type information?


More information about the Digitalmars-d mailing list