backslash
{{Short description|Typographical mark (\)}}
{{Distinguish|Backlash (disambiguation){{!}}Backlash|₩|¥}}
{{Technical reasons|:\|the emoticon|List of emoticons}}
{{Infobox symbol
|mark=\
|unicode={{unichar|005C|html=}}
|see also={{unichar|002F}}
}}
The backslash {{char|\}} is a mark used mainly in computing and mathematics. It is the mirror image of the common slash {{char|/}}. It is a relatively recent mark, first documented in the 1930s. It is sometimes called a hack, whack, escape (from C/UNIX), reverse slash, slosh, downwhack, backslant, backwhack, bash, reverse slant, reverse solidus, and reversed virgule.Macquarie Dictionary (3rd edition){{cite web | url=http://www.catb.org/jargon/html/A/ASCII.html | title=ASCII | last=Raymond | first=Eric S | website=The Jargon File | access-date=2007-07-28 | archive-date=2019-01-18 | archive-url=https://web.archive.org/web/20190118060854/http://catb.org/jargon/html/A/ASCII.html | url-status=live }}
History
File:Teletype Wheatstone Perforator keyboard.jpg
File:Mappa Teletype ASR-33.jpg
{{as of|2022|11}}, efforts to identify either the origin of this character or its purpose before the 1960s have not been successful. The earliest known reference found to date is a 1937 maintenance manual from the Teletype Corporation with a photograph showing the keyboard of its Kleinschmidt keyboard perforator WPE-3 using the Wheatstone system.{{citation |mode=cs1 |title=Bulletin 125, issue 2: Description and Adjustments of the Teletype Wheatstone Perforator |publisher=Teletype Corporation |date=May 1938 |orig-date=August 1937 |url=http://www.navy-radio.com/manuals/tty/tty125.pdf |page=ii |via=navy-radio.com |access-date=2021-03-15 |archive-date=2021-02-12 |archive-url=https://web.archive.org/web/20210212121807/http://www.navy-radio.com/manuals/tty/tty125.pdf |url-status=live }} The symbol was called the "diagonal key",{{cite web |title=Bulletin 188: Teletype automatic perforator set |page=6 |url=https://www.navy-radio.com/manuals/tty/188B-4508.pdf |publisher=Teletype Corporation |date=August 1945 |via=navy-radio.com |access-date=2021-12-19 |archive-date=2021-12-19 |archive-url=https://web.archive.org/web/20211219004736/https://www.navy-radio.com/manuals/tty/188B-4508.pdf |url-status=live}} and given a (non-standard) Morse code of {{morse|dot|dash|dot|dot|dash}}.{{cite web |title=Bulletin 1025, issue 3: Parts for Teletype Wheatstone Perforator |page=9 |url=https://www.navy-radio.com/manuals/tty/tty1025.pdf |date=July 1945 |publisher=Teletype Corporation |via=navy-radio.com |access-date=2021-12-19 |archive-date=2021-12-19 |archive-url=https://web.archive.org/web/20211219003141/https://www.navy-radio.com/manuals/tty/tty1025.pdf |url-status=live }}{{efn|This is the inverse of the code for the slash symbol ({{morse|dash|dot|dot|dash|dot}}).}}
In June 1960, IBM published an "Extended character set standard" that includes the symbol at 0x19.{{cite web |title=The Evolution of Character Codes, 1874–1968 |date=20 June 2000 |first=Eric |last=Fischer |pages=14–15 (Table 35) |url=http://dump.deadcodersociety.org/ascii.pdf |access-date=30 November 2022 |archive-date=30 November 2022 |archive-url=https://web.archive.org/web/20221130065133/http://dump.deadcodersociety.org/ascii.pdf |url-status=live }} Referencing {{cite tech report |first1=R.W. |last1=Bemer |first2=W. |last2=Buchholz |title=An Extended Character Set Standard |id=TR 00.721 |publisher=Product Development Laboratory, Data Systems Division, International Business Machines Corporation |date=June 1, 1960}} Computer Standards Collection, Archives Center, National Museum of American History, Smithsonian Institution, box 1. In September 1961, Bob Bemer (IBM) proposed to the X3.2 standards committee that {{code|[}}, {{code|]}} and {{code|\}} be made part of the proposed standard, describing the backslash as a "reverse division operator" and cited its prior use by Teletype in telecommunications. In particular, he said, the {{mono|\}} was needed so that the ALGOL Boolean operators {{code|∧}} (logical conjunction) and {{code|∨}} (logical disjunction) could be composed using {{mono|/\}} and {{mono|\/}} respectively. The Committee adopted these changes into the draft American Standard (subsequently called ASCII) at its November 1961 meeting.
These operators were used for min and max in early versions of the C programming language supplied with Unix V6{{cite web |url=http://www.bitsavers.org/bits/Interdata/32bit/unix/univWollongong%5Fv6/interdata%5Fv6/usr/source/c/c00.c |title=C compiler source |date=1975 |website=bitsavers.org |access-date=2009-10-11 |archive-date=2011-08-15 |archive-url=https://web.archive.org/web/20110815153104/http://www.bitsavers.org/bits/Interdata/32bit/unix/univWollongong_v6/interdata_v6/usr/source/c/c00.c |url-status=live }} and V7.{{cite web |url=http://stuff.mit.edu/afs/sipb/project/v7unix/fs/usr/src/cmd/c/c00.c |title=C compiler source |date=1979 |website=mit.edu |access-date=2009-10-11 |archive-date=2013-12-03 |archive-url=https://web.archive.org/web/20131203022053/http://stuff.mit.edu/afs/sipb/project/v7unix/fs/usr/src/cmd/c/c00.c |url-status=live }}
Usage
=Programming languages=
In many programming languages such as C, Perl, PHP, Python and Unix scripting languages, and in many file formats such as JSON, the backslash is used as an escape character, to indicate that the character following it should be treated specially (if it would otherwise be treated literally), or literally (if it would otherwise be treated specially). For instance, inside a C string literal the sequence {{code|\n}} produces a newline byte instead of an 'n', and the sequence {{code|\"}} produces an actual double quote rather than the special meaning of the double quote ending the string. An actual backslash is produced by a double backslash {{code|\\}}.
Regular expression languages used it the same way, changing subsequent literal characters into metacharacters and vice versa. For instance {{mono|\{{vbar}}{{vbar}}b}} searches for either '|' or 'b', the first bar is escaped and searched for, the second is not escaped and acts as an "or".
{{anchor|line-continuation}}Outside quoted strings, the only common use of backslash is to ignore ("escape") a newline immediately after it. In this context it may be called a "continued line"{{cite web |url=https://gcc.gnu.org/onlinedocs/gcc-3.2.3/cpp/Initial-processing.html |title=The C Preprocessor |website=GNU.org |access-date=2021-01-04 |archive-date=2021-08-03 |archive-url=https://web.archive.org/web/20210803000553/https://gcc.gnu.org/onlinedocs/gcc-3.2.3/cpp/Initial-processing.html |url-status=live }} as the current line continues into the next one. Some software replaces the backslash+newline with a space.{{cite book|chapter=3.1.1 Splitting long lines|title=GNU {{font|make|size=80%}} manual|chapter-url=https://www.gnu.org/software/make/manual/make.html#Splitting-Lines|access-date=July 28, 2019|archive-date=June 5, 2018|archive-url=https://web.archive.org/web/20180605023853/https://www.gnu.org/software/make/manual/make.html#Splitting-Lines|url-status=live}}
To support computers that lacked the backslash character, the C trigraph {{code|??/}} was added, which is equivalent to a backslash. Since this can escape the next character, which may itself be a {{code|?}}, the primary modern use may be for code obfuscation. Support for trigraphs in C++ was removed in C++17, and support for them in C was removed in C23.https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2940.pdf
In Visual Basic (and some other BASIC dialects) the backslash is used as an operator symbol to indicate integer division.{{cite web|title=Arithmetic Operators in Visual Basic|url=http://msdn.microsoft.com/en-us/library/b6ex274z(v=vs.110).aspx|work=Visual Basic Language Features: Operators and Expressions| date=10 July 2012 |publisher=MSDN|access-date=7 October 2012|archive-date=17 September 2012|archive-url=https://web.archive.org/web/20120917100112/http://msdn.microsoft.com/en-us/library/b6ex274z(v=vs.110).aspx|url-status=live}} This rounds toward zero.
The ALGOL 68 programming language uses the "\" as its Decimal Exponent Symbol. ALGOL 68 has the choice of 4 Decimal Exponent Symbols: e, E, \, or 10. Examples: {{mono|6.0221415e23}}, {{mono|6.0221415E23}}, {{mono|6.0221415\23}} or {{mono|6.02214151023}}.{{cite journal | title=Revised Report on the Algorithmic Language Algol 68 | journal=Acta Informatica | volume=5 | issue=1–3 | pages=1–236 | date=September 1973 | doi=10.1007/BF00265077 | s2cid=2490556 | url=https://ir.cwi.nl/pub/13447 | access-date=2020-02-10 | archive-date=2020-07-26 | archive-url=https://web.archive.org/web/20200726125450/https://ir.cwi.nl/pub/13447 | url-status=live }}
In APL {{mono|\}} is called Expand when used to insert fill elements into arrays, and Scan when used to produce prefix reduction (cumulative fold).
In PHP version 5.3 and higher, the backslash is used to indicate a namespace.{{cite web |url=http://php.net/manual/en/language.namespaces.rationale.php |title=Namespaces overview |website=php.net |access-date=2012-10-10 |archive-date=2012-10-16 |archive-url=https://web.archive.org/web/20121016184321/http://www.php.net/manual/en/language.namespaces.rationale.php |url-status=live }}
In Haskell, the backslash is used both to introduce special characters and to introduce lambda functions (since it is a reasonable approximation in ASCII of the Greek letter {{nowrap|lambda, λ)}}.O'Sullivan, Stewart, and Goerzen, Real World Haskell, ch. 4: anonymous (lambda) functions, p.99
=Filenames=
MS-DOS 2.0, released 1983, copied the idea of a hierarchical file system from Unix and thus used the (forward) slash as the directory separator.{{cite web |url=https://learn.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character |title=Why is the DOS path character "\"? |publisher=Blogs.msdn.com |date=2005-06-24 |access-date=2013-06-16 |archive-date=2022-11-19 |archive-url=https://web.archive.org/web/20221119103949/https://learn.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character |url-status=live }} Possibly on the insistence of IBM,{{ cite web | url = http://www.os2museum.com/wp/why-does-windows-really-use-backslash-as-path-separator/ | title = Why Does Windows Really Use Backslash as Path Separator? | access-date = 28 May 2019 | last = Necasek | first = Michal | date = 24 May 2019 | website =
{{cite web
| url = http://msdn.microsoft.com/en-us/library/system.io.path.getfullpath.aspx
| title = Path.GetFullPath Method
| work = .NET Framework Class Library
| publisher = Microsoft
| access-date = 2009-01-02
| archive-url= https://web.archive.org/web/20081221114738/http://msdn.microsoft.com/en-us/library/system.io.path.getfullpath.aspx| archive-date= 21 December 2008 | url-status= live}} In some versions, the option character can be changed from {{mono|/}} to {{mono|-}} via SWITCHAR, which allows COMMAND.COM to preserve {{mono|/}} in the command name.
The Microsoft Windows family of operating systems inherited the MS-DOS behavior and so still support either character – but individual Windows programs and sub-systems may, wrongly, only accept the backslash as a path delimiter, or may misinterpret a forward slash if it is used as such. Some programs will only accept forward slashes if the path is placed in double-quotes.
{{cite web
| url = http://bytes.com/groups/python/23123-when-did-windows-start-accepting-forward-slash-path-separator
| title = When did Windows start accepting forward slash as a path separator?
| publisher = Bytes.com
| access-date = 2009-01-02
| archive-url= https://web.archive.org/web/20090206050805/http://bytes.com/groups/python/23123-when-did-windows-start-accepting-forward-slash-path-separator| archive-date= 6 February 2009 | url-status= live}} The failure of Microsoft's security features to recognize unexpected-direction slashes in local and Internet paths, while other parts of the operating system still act upon them, has led to some serious lapses in security. Resources that should not be available have been accessed with paths using particular mixes, such as {{mono|
|url=http://www.devsource.com/c/a/Using-VS/Microsoft-Probes-Flaw-in-ASPNET/
|archive-url=https://archive.today/20130121115529/http://www.devsource.com/c/a/Using-VS/Microsoft-Probes-Flaw-in-ASPNET/
|url-status=dead
|archive-date=2013-01-21
|title=Microsoft Probes Flaw in ASP.NET
|last=Kaplan
|first=Simone
|publisher=Ziff Davis Enterprise Holdings Inc.
|work=DevSource, sponsored by Microsoft
|year=2004
|access-date=2009-06-14
| url=http://www.securityfocus.com/columnists/285
| title=Security Holes That Run Deep
| last=Burnett
| first=Mark
| publisher=SecurityFocus
| year=2004
| access-date=2009-06-14
| archive-date=2021-02-02
| archive-url=https://web.archive.org/web/20210202211420/https://www.securityfocus.com/columnists/285
| url-status=live
}}
=Text markup=
The backslash is used in the TeX typesetting system and in RTF files to begin markup tags.
In USFM,{{cite web|url=http://paratext.org/usfm|title=USFM – Unified Standard Format Markers|work=paratext.org|date=18 April 2017|access-date=30 June 2013|archive-date=13 August 2020|archive-url=https://web.archive.org/web/20200813060533/https://paratext.org/usfm/|url-status=live}} the backslash is used to mark format features for editing Bible translations.
In caret notation, {{code|^\}} represents the control character 0x1C, file separator.{{cite web |title=C0 control characters set, 1987 |url=http://wwwcdf.pd.infn.it/AppuntiLinux/a2138.htm#almlanchor1706 |website=pd.infn.it |access-date=2021-03-14 |archive-date=2019-09-06 |archive-url=https://web.archive.org/web/20190906020303/http://wwwcdf.pd.infn.it/AppuntiLinux/a2138.htm#almlanchor1706 |url-status=live }} This is entirely a coincidence and has nothing to do with its use in file paths.
=Mathematics=
A backslash-like symbol is used for the set difference.{{cite web|title=Quantities and units – Part 2: Mathematical signs and symbols to be used in the natural sciences and technology|url=http://www.iso.org/iso/catalogue_detail?csnumber=31887|work=ISO 80000-2:2009| date=15 April 2008 |publisher=International Organization for Standardization|access-date=2012-10-07|archive-date=2014-03-26|archive-url=https://web.archive.org/web/20140326013017/http://www.iso.org/iso/catalogue_detail?csnumber=31887|url-status=live}}
The backslash is also sometimes used to denote the right coset space.{{cite web |title=Definition:Coset Space |url=https://proofwiki.org/w/index.php?title=Definition:Coset_Space&oldid=227233 |publisher=ProofWiki |access-date=1 February 2017 |archive-date=26 February 2021 |archive-url=https://web.archive.org/web/20210226163838/https://proofwiki.org/w/index.php?title=Definition:Coset_Space&oldid=227233 |url-status=live }}
Especially when describing computer algorithms, it is common to define backslash so that {{math|a\b}} is equivalent to {{math|{{floor|a/b}}}}.{{cite web|title=Integer Division|url=https://mathworld.wolfram.com/IntegerDivision.html|website=mathworld.wolfram.com|access-date=2020-03-10|archive-date=2020-02-21|archive-url=https://web.archive.org/web/20200221154259/http://mathworld.wolfram.com/IntegerDivision.html|url-status=live}} This is integer division that rounds down, not towards zero.
In MATLAB and GNU Octave the backslash is used for left matrix divide, while the (forward) slash is for right matrix divide.{{cite web|last=Eaton|first=John W.|title=GNU Octave: A high-level interactive language for numerical computations|url=https://www.gnu.org/software/octave/octave.pdf|publisher=Free Software Foundation|access-date=7 October 2012|author2=David Bateman|author3=Søren Hauberg|page=145|date=February 2011|archive-date=24 October 2012|archive-url=https://web.archive.org/web/20121024061422/http://www.gnu.org/software/octave/octave.pdf|url-status=live}}
Confusion with ¥ and other characters
In the Japanese encodings ISO 646-JP (a 7-bit code based on ASCII), JIS X 0201 (an 8-bit code), and Shift JIS (a multi-byte encoding which is 8-bit for ASCII), the code point 0x5C that would be used for backslash in ASCII is instead rendered as a yen sign {{char|¥}}. Due to extensive use of the 005C code point to represent the yen sign, even today some fonts such as MS Mincho render the backslash character as a ¥, so the characters at Unicode code points {{unichar|00A5}} and {{unichar|005C}} both render as {{char|¥}} when these character sets are selected. Computer programs still treat 005C as a backslash in these environments but display it as a yen sign, causing confusion, especially in MS-DOS filenames.{{cite web |url=http://www.siao2.com/2005/09/17/469941.aspx |title=When is a backslash not a backslash? |publisher=Blogs.msdn.com |access-date=2013-06-16 |archive-date=2016-03-23 |archive-url=https://web.archive.org/web/20160323062003/http://www.siao2.com/2005/09/17/469941.aspx |url-status=live }}
Several other ISO 646 versions also replace backslash with other characters, including ₩ (Korean), Ö (German, Swedish), Ø (Danish, Norwegian), ç (French) and Ñ (Spanish), leading to similar problems, though with less lasting impact compared to the yen sign. Although the conflict is resolved by unique code point allocations in Unicode, the longevity of legacy systems means that (although diminishing) the issue continues to persist.
In 1991, RFC 1345 suggested {{code|//}} as a unique two-character mnemonic that might be used in internet standards as "a practical way of identifying [this] character, without reference to a coded character set and its code in [that] coded character set".{{cite web |url=https://tools.ietf.org/html/rfc1345 |title=RFC 1345 |publisher=Tools.ietf.org |date=1991-12-26 |access-date=2013-06-16 |last1=Simonsen |first1=Keld |archive-date=2016-06-13 |archive-url=https://web.archive.org/web/20160613195948/https://tools.ietf.org/html/rfc1345 |url-status=live }} Consequently, this style may be seen in early Internet Engineering Task Force documents.
Unicode
Unicode has codepoints for a variety of backslash symbols:
- {{unichar|005C|html=}}
- {{unichar|29F5}}
- {{unichar|29F9}}
- {{unichar|2572}}
- {{unichar|FE68|nlink=Small Form Variants}}
- {{unichar|FF3C}}
- {{unichar|244a}}
- {{unichar|2216|nlink=∖}}
- {{unichar|1f67d}}
Notes
{{notelist}}
References
{{reflist}}
External links
- {{cite web|author=Bob Bemer |url=http://www.trailing-edge.com/~bobbemer/BACSLASH.HTM| title=How ASCII got its backslash |archive-url=https://web.archive.org/web/20130719181924/http://www.trailing-edge.com/~bobbemer/BACSLASH.HTM |archive-date=2013-07-19}}
{{navbox punctuation}}