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

Steven Schveighoffer schveiguy at yahoo.com
Thu May 31 05:29:21 PDT 2012


On Thu, 31 May 2012 08:27:17 -0400, Sandeep Datta  
<datta.sandeep at gmail.com> wrote:

>>
>> If we removed the requirement for the ampersand, along with requiring  
>> parentheses for non-property functions, code which expected to call the  
>> function without parentheses would silently compile, but not do what  
>> was intended.
>
>
> Consider this...
>
> float handleRequest() {
>   return 1.0f;
> }
>
> float x = handleRequest; //compilation error
>
> or
>
> auto x = handleRequest;
>
> writefln("%f", x); //compilation error

What about:

handleRequest;

-Steve


More information about the Digitalmars-d mailing list