Reputation: 4474
I've noticed that this declaration involving a caret (^) character is pinned on the cdecl.org site at the top:
// "cast foo into block(int, long long) returning double"
(double (^)(int , long long ))foo
Can somebody explain what is the purpose of the caret character here? Is this really a valid character in C declarations, or is this a placeholder for something?
Upvotes: 10
Views: 719
Reputation: 20901
It is known as Block Variable Declaration
. A variable with Block type is declared using function pointer style notation substituting ^
for *
.
Upvotes: 4
Reputation: 222900
The caret is part of an extension to the C language to work with blocks. Blocks are an extension to C supported by Clang and Apple’s GCC. It is not strictly conforming C (that is, not part of the core C language defined by the C standard).
Upvotes: 6