^ | |
---|---|
Caret | |
In Unicode | U+005E ^CIRCUMFLEX ACCENT (^) |
Different from | |
Different from | U+2038 ‸CARET U+02C6 ˆMODIFIER LETTER CIRCUMFLEX ACCENT U+028C ʌLATIN SMALL LETTER TURNED V U+2227 ∧LOGICAL AND U+039B ΛGREEK CAPITAL LETTER LAMDA |
Related | |
See also | U+FF3E ^FULLWIDTH CIRCUMFLEX ACCENT |
Caret (from Latin caret 'there is lacking')[3] is the name used familiarly for thecharacter^ provided on mostQWERTY keyboards by typing⇧ Shift+6. The symbol has a variety of uses in programming and mathematics. The name "caret" arose from its visual similarity to the originalproofreader's caret,‸, a mark used inproofreading to indicate where a punctuation mark, word, or phrase should be inserted into a document. TheASCII standard (X3.64.1977) calls it a "circumflex";[4] the Unicode standard calls it a "circumflex accent", although it is no longer practicable for that purpose.
On typewriters designed for languages that routinely usediacritics (accent marks), there are two possible ways to type these: keys can be dedicated toprecomposed characters (with the diacritic included); alternatively adead key mechanism can be provided. With the latter, a mark is made when a dead key is typed but, unlike normal keys, the paper carriage does not move on and thus the next letter to be typed is printed under the accent. The^ symbol was originally provided in typewriters and computer printers so thatcircumflex accents could be overprinted on letters (as inô orŵ).
The incorporation of the circumflex symbol into ASCII is a consequence of this prior existence on typewriters: this symbol did not exist independently as atype orhot-lead printing character. The original1963 version of the ASCII standard used the code point0x5E for anup-arrow ↑. However, the 1965ISO/IEC 646 standard defined code point0x5E as one of five available for national variation,[a] with the circumflex^ diacritic as the default and the up-arrow as one of the alternative uses.[5] In 1967, the second revision of ASCII followed suit.[6]
Overprinting to add an accent mark was not always supported well by printers, and was almost never possible on video terminals. The freestanding circumflex (which had come to be called a caret) quickly became reused for many other purposes, such as incomputer languages and mathematical notation. As the mark did not need to fit above a letter any more, it became larger in appearance such that it can no longer be used to overprint an accent in most fonts.[7] Accented letters eventually because widely supported by adding precomposed characters[b] instead of using overprinting.
InUnicode the symbol is encoded asU+005E ^CIRCUMFLEX ACCENT; inHTML it may be used directly or inserted with^
. Thecombining character for use as a diacritic isU+0302 ◌̂COMBINING CIRCUMFLEX ACCENT, althoughprecomposed characters (likeU+00E2 âLATIN SMALL LETTER A WITH CIRCUMFLEX) are available for most European languages.
The symbol^ has many uses inprogramming languages, where it is typically called a caret. It can signifyexponentiation, the bitwiseXOR operator,string concatenation[citation needed], andcontrol characters incaret notation, among other uses. Inregular expressions, the caret is used to match the beginning of a string or line; if it begins a character class, then the inverse of the class is to be matched.
ANSI C can transcribe the caret in the form of thetrigraph??'
, as the character was originally not available in all character sets and keyboards.C++ additionally supports tokens likexor
(for^
) andxor_eq
(for^=
) to avoid the character altogether.RFC 1345 recommends that the character be transcribed asdigraph'>
when required.[8]
Pascal uses the caret for declaring and dereferencingpointers.InSmalltalk, the caret is the method return statement.InC++/CLI, .NET reference types are accessed through a handle using theClassName^
syntax.In Apple'sC extensions for Mac OS X and iOS, carets are used to createblocks and to denote block types.Go uses it as abitwise NOT operator.
Node.js uses the caret inpackage.json files to signify dependency resolution behavior being used for each particular dependency. In the case of Node.js, a caret allows any kind of update, unless it is seen as a "major" update as defined bysemver.[9]
Inmathematics, the caret can signifyexponentiation (e.g.3^5
for35) where the usualsuperscript is not readily usable (as on somegraphing calculators). It is also used to indicate a superscript inTeX typesetting.
The use of the caret for exponentiation can be traced back toALGOL 60,[citation needed] which expressed the exponentiation operator as an upward-pointing arrow, intended to evoke the superscript notation common in mathematics. The upward-pointing arrow is now used to signifyhyperoperations inKnuth's up-arrow notation.
It is often seen incaret notation to show control characters: for instance,^A
means the control character with value 1.
The Windows command-line interpreter (cmd.exe) uses the caret toescape reserved characters[citation needed] (most other shells use thebackslash). For example, to pass a 'less-than' sign as an argument to a program, one would type^<
.
Ininternet forums, onsocial networking sites such as Facebook, or inonline chats, one or more carets may be used beneath the text of another post, representing an upward-pointing arrow to that post;[10] in addition to the arrow usage, it can also mean that the user who posted the ^ agrees with the above post. Multiple carets may be used to indicate that the comment is replying to, or relating to, the post above that correlates with the number of carets used, or to "underscore" the correct portion of the previous post, or simply for emphasis.
A similar use has been adopted by programming languagecompilers, such as the Java compiler, to point out where acompilation error has occurred.[citation needed] The compiler prints out the faulty line of code and uses a single caret on the next line, padded by spaces, to give a visual indication of the error location.