spec: Function types

Dibyendu Majumdar mobile at majumdar.org.uk
Sat Nov 21 00:46:33 UTC 2020


On Saturday, 21 November 2020 at 00:42:06 UTC, Paul Backus wrote:
> On Saturday, 21 November 2020 at 00:26:45 UTC, Dibyendu 
> Majumdar wrote:
>> So a type declared using 'function' is actually a function 
>> pointer type.
>>
>> What is the type of a function in D?
>
> int fun(int x);
> pragma(msg, typeof(fun).stringof); // int(int x)
> alias funType = int(int x);
> static assert(is(funType == typeof(fun)));

thanks


More information about the Digitalmars-d mailing list