What is this strange alias syntax?
Stewart Gordon
smjg_1998 at yahoo.com
Sun May 22 07:12:55 PDT 2011
On 21/05/2011 10:15, Simen Kjaeraas wrote:
> On Sat, 21 May 2011 05:12:20 +0200, Andrej Mitrovic <none at none.none> wrote:
>
>> Taken from the docs:
>>
>> alias int func(int);
<snip>
> It's the old C syntax for defining function pointers.
<snip>
Functions, not function pointers. The C syntax for declaring function pointers is
int (*func)(int);
In C (with "typedef" instead of "alias"), what you're effectively doing is declaring a
type that you can't use directly, but can declare pointers to.
But why does this exist in D?
Stewart.
More information about the Digitalmars-d-learn
mailing list