Re:/ vs. \ confuses me a lot, how do you remember them?
by 9wzYQbTYsAIc on Sunday October 09, 2022 @02:13AM
(#33138655)
Also, path separation in URIs uses / as a path separator but // to identify the authority
Re:/ vs. \ confuses me a lot, how do you remember them?
by schoen on Monday October 10, 2022 @12:52AM
(#33147896)
I think Windows also does that with file sharing where it uses remote references like "\\host\path".
Re:/ vs. \ confuses me a lot, how do you remember them?
by 9wzYQbTYsAIc on Monday October 10, 2022 @02:07AM
(#33148299)
And is it a \ or / between domain and username in Windows?
Trial and error, every time on that one.
In the Windows command line, \ is the path separator and / is for options.
That diverges from the Unix command line, where / is the path separator and \ is for escaping special characters ("use the literal meaning of this character, rather than the special meaning"). The Unix command line uses hyphen (-) for options.
Most programming languages use \ for escaping special characters, so \" would often be a literal quotation mark and \\ would often be a literal backslash. For example, in many languages writing
will give a one-byte-long string containing a quotation mark character. Here the backslash escapes the second quotation mark, cancelling out its meaning of ending the string.https://en.wikipedia.org/wiki/Use%E2%80%93mention_distinctio...
https://en.wikipedia.org/wiki/Escape_character
The second article mentions a further subtlety, which is that escaping a character that doesn't have a special meaning sometimes adds a special meaning. For example, "\t" is used in many programming languages to write the tab character (ASCII 9), while "\n" is used to write the newline character (ASCII 10).