Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C "block" caret character

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?

like image 549
Lou Avatar asked Mar 09 '20 11:03

Lou


People also ask

How do you type a caret symbol?

Caret is the name used familiarly for the character ^, provided on most QWERTY keyboards by typing ⇧ Shift + 6 . The symbol has a variety of uses in programming and mathematics.

What is a caret symbol?

The caret (^) is a typographical symbol (not a punctuation mark) that can be used in various fields to indicate different things. In writing, it is commonly seen in proofreading and informal writing situations. It is also used in mathematics and computer programming.

Why is it called a caret?

The caret was originally and continues to be used in handwritten form as a proofreading mark to indicate where a punctuation mark, word, or phrase should be inserted into a document. The term comes from the Latin word caret, "it lacks", from carēre, "to lack; to be separated from; to be free from".

What does caret mean in Swift?

Using a caret (^) sign means that we can accept minor releases and patch releases, but not a major release when updating our package.


1 Answers

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).

like image 82
Eric Postpischil Avatar answered Oct 23 '22 03:10

Eric Postpischil