The hyphen-minus,, is a character used in digital documents and computing to represent a hyphen, a minus sign, or an en dash. Typewriter keyboards and early computer encodings had only one character that looked like this, so its design had to be a compromise between the different typographical appearances. The proper name is rarely used: the character is referred to as a hyphen, a dash or a minus according to the context where it is being used.
Description
The use of a single character for both hyphen and minus was a compromise made in the early days of fixed-width typewriters and computer displays. However, in proper typesetting and graphic design, there are distinct characters for hyphens, dashes, and the minus sign. Usage of the hyphen-minus nonetheless persists in many contexts, as it is well known, easy to enter on keyboards, and in the same location in all common character sets. In proportional fonts the hyphen-minus is usually the size of, or slightly bigger than, a hyphen, and smaller than a minus sign. This results in an unattractive appearance when mixed with plus signs. Also many word processors will allow a word wrap after a hyphen-minus, unlike the minus sign proper which is treated as a mathematical symbol no different from any unspaced number or letter. These differences make its use undesirable in professional typography.
Uses
Typing
This character is often typed when a hyphen, a minus sign or an en dash is wanted. Based on old typewriter conventions, it is common to use a pair to represent an em dash, and some word processors automatically convert this pair to an em dash. The character can also be used in place of the box-drawing character to simulate a horizontal line or alternated with spaces to make a "dashed" line that indicates where paper is to be cut.
Programming languages
Most programming languages use the hyphen-minus for denoting subtraction and negation. It is almost never used to indicate a range, due to ambiguity with subtraction. Generally other characters, such as the Unicode are not recognized. In some programming languages marks beginning of a comment. Likewise, it can occasionally start the signature block. YAML uses a triple dash to end a section.
The character is often used when specifying command-line options, a convention mostly started by Unix. Options might be or, a user can specify both by using. Various implementations of the getopt function allow two hyphen-minuses to specify "long" option names as, which are much easier to read while being much harder to memorize and write. A double hyphen-minus by itself indicates that there are no more options, which is useful when one needs to specify a filename that starts with a hyphen-minus. An option of just a hyphen-minus may be recognized of a filename and indicates that stdin is to be read.
Encoding
The glyph has a code point in Unicode as ; it is also in ASCII with the same value.