News for hackers. Stuff that matters.
Re:Why Does Windows Use Backslash as Path Separator? by canucker2016 on Wednesday April 24, 2024 @06:25PM (#40150585)
Windows used many of the MSDOS services, like file system access. Windows was built on top of MSDOS in the beginning.

Windows predates OS/2 (OS/2 development started in 1985 according to Wikipedia)

How is it a poor engineering decision?

What about the original Mac OS using colon as a path separator? Or Lisa OS using the hyphen as a path separator?

see https://retrocomputing.stackexchange.com/questions/17069/why...

Re:Why Does Windows Use Backslash as Path Separator? by Joe_Cool on Wednesday April 24, 2024 @06:40PM (#40150739)
Japanese DOS had ¥ as the path separator or more specific at 0x5C. It still causes headache with the MS Mincho font. Japanese users are used to seeing ¥ at the DOS prompt so some Windows Console fonts just replace the backslash.

Since you never know if it's a backslash or an actual Yen sign. Total fun.

Re:Why Does Windows Use Backslash as Path Separator? by Dwedit on Wednesday April 24, 2024 @07:13PM (#40151064)
MS Mincho and MS Gothic (and many others including Meiryo) both use the Yen Sign (unicode 0xA5) character graphic for the Backslash character. There are also a few Japanese fonts (such as Sazanami Gothic) that don't do this.

The separate halfwidth yen sign does not exist in Shift-JIS at all. So any time a non-unicode Japanese Win32 application needs to draw a halfwidth yen sign, it must draw a backslash. And you can't make the official character mapping convert Backslash 0x5C into Yen sign 0xA5, otherwise all file paths would break.

Re:Why Does Windows Use Backslash as Path Separator? by naikrovek on Wednesday April 24, 2024 @06:31PM (#40150655)
> Microsoft reportedly wanted to use the forward slash as path separator, but IBM nixed the idea because it would have created an incompatibility with DOS 1.x, which already used the forward slash as a switch character, separating command options.

It isn’t a poor engineering decision, that guy just didn’t read the decision criteria.

Also, according to spec, CRLF is the proper sequence for a newline, and both Unix and MacOS chose incorrectly.

Re:Why Does Windows Use Backslash as Path Separator? by Alupis on Wednesday April 24, 2024 @06:52PM (#40150851)
Which spec would that be? It's not the ISO spec, nor POSIX.

CRLF existed originally because of mechanical typerwriters required two separate actions - Carriage Return (move the carriage back to the start of the line), Line Feed (advance the page to the next line).

CR is a waste for computing... it literally does nothing beneficial.

Someone should figure out the climate impact of decades of wasted processing of CR characters... that might motivate people to fix this as well.

Re:Why Does Windows Use Backslash as Path Separator? by naikrovek on Wednesday April 24, 2024 @08:29PM (#40151707)
> Someone should figure out the climate impact of decades of wasted processing of CR characters... that might motivate people to fix this as well.

LF vs CRLF is a single molecule of water compared to the seven seas of waste created by Electron apps or even just JavaScript itself. Todays developers are lazy as FUCK and there is no pressure for them to stop being lazy.

See: https://tonsky.me/blog/js-bloat/

> CR is a waste for computing... it literally does nothing beneficial.

When “LF” means “line feed and carriage return” both, as it does thanks to UNIX, yes. On teletype machines “line feed” meant “line feed” and “carriage return” meant “carriage return”. You need both.

Today we use an LF which means both “CR” and “LF” and we act like CR is the problem, when it was us choosing a single byte to mean two separate things joined together.

Even as a kid in school in typing class, I used a typewriter with a parallel port (probably serial, really, because you could use the keyboard without putting text on paper), and it could be used to print text sent to it. CR and LF had very different meanings on that typewriter. I wish I remembered what make and model it was…

Re:Why Does Windows Use Backslash as Path Separator? by tracker1 on Wednesday April 24, 2024 @09:48PM (#40152381)
It's not the same in many terminals... I also think lack of Vertical tabs on keyboards is sometimes a shortcoming.
Re:Why Does Windows Use Backslash as Path Separator? by Const-me on Wednesday April 24, 2024 @10:39PM (#40152722)
> CR is a waste for computing... it literally does nothing beneficial

CR enables to update a line of text. Print some text without newline at the end, print CR, print another line, and the old text will be overwritten with the new one.

Some command-line apps are using the trick to print progress bars, progress percentage, or similar. This is very beneficial.

Re:Why Does Windows Use Backslash as Path Separator? by Alupis on Wednesday April 24, 2024 @10:52PM (#40152811)
This is almost always implemented using direct placement of the cursor, not via a literal CR char/command. CR is literally useless, except for being artificially required in some windows text editors.
Re:Why Does Windows Use Backslash as Path Separator? by Const-me on Wednesday April 24, 2024 @11:14PM (#40152979)
Cursor placement is hard to do portably because every OS has incompatible ways for that. You gonna need SetConsoleCursorPosition on Windows, and multiple versions of these terminal escape codes on Linux.

printf( "\rsomething " ) is much easier.

Re:Why Does Windows Use Backslash as Path Separator? by skissane on Thursday April 25, 2024 @02:25AM (#40154116)
> Which spec would that be? It's not the ISO spec, nor POSIX.

RFC3676, RFC2045, among others. CRLF is the Internet standard newline

Re:Why Does Windows Use Backslash as Path Separator? by naikrovek on Thursday April 25, 2024 @10:33AM (#40158079)
thank you. I was about to look, but saw this.
Re:Why Does Windows Use Backslash as Path Separator? by Alupis on Thursday April 25, 2024 @10:35AM (#40158098)
Which explains it's use in operating systems how exactly?
Re:Why Does Windows Use Backslash as Path Separator? by skissane on Thursday April 25, 2024 @02:09PM (#40161043)
How did it become the Internet standard? Because at the time it was adopted as the Internet standard the majority of operating systems used it. Probably the biggest influence on both the Internet standard and Microsoft was DEC. And actually, it is used by Unix too, in the TTY layer: Unix by default translates LF to CRLF on output - and that translation is in the POSIX standard. So the claim that CRLF isn’t in POSIX is false
Re:Why Does Windows Use Backslash as Path Separator? by TillE on Wednesday April 24, 2024 @06:30PM (#40150645)
Yeah I think it's far more interesting to view this as a series of people making probably the best possible decision at the time, and winding up in a slightly unfortunate, suboptimal place.

That's hardly uncommon! Examine the history of basically anything.