The use of one character for hyphen and minus, and sometimes also for en dash, 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.
Most programming languages, restricting themselves to ASCII, use the hyphen-minus, rather than the Unicode character U+2212−minus sign, for denoting subtraction and negative numbers.
The en dash is preferred in writing when dealing with ranges, such as 2000–2004, although less formal writings may use hyphen-minuses.
Historically, an em dash is represented by three hyphen-minus signs in succession (as later in TeX markup), or sometimes two. Microsoft Word typically allows the user to enter an em dash by typing two hyphen-minus signs.