W
werasm
Hi all,
I have recently come accross this function declaration syntax.
Initially it was puzzling (still is, to be honest), but I now realize
that it declares a function that returns a reference to an array.
The declarator:
char (& foo() )[6]; //(1)
I would have suspected something like...
char(&)[6] foo(); //(2)
.... to be the declarator for a function returning a ref to an array,
but it does not seem so. Could someone explain this syntax to me, and
maybe a reason why (2) is not the function declarator syntax, and (1)
is so different from other function declarators.
Regards,
Werner
I have recently come accross this function declaration syntax.
Initially it was puzzling (still is, to be honest), but I now realize
that it declares a function that returns a reference to an array.
The declarator:
char (& foo() )[6]; //(1)
I would have suspected something like...
char(&)[6] foo(); //(2)
.... to be the declarator for a function returning a ref to an array,
but it does not seem so. Could someone explain this syntax to me, and
maybe a reason why (2) is not the function declarator syntax, and (1)
is so different from other function declarators.
Regards,
Werner