Why is there an escape sequence for VERTICAL TAB?

Another question, What is a vertical tab? , describes what the vertical tab symbol was originally used for.

But why was U+000B VERTICAL TAB considered important enough to highlight the escape sequence ( '\v' ), primarily in C and many other programming languages?

See also: some guy complains about it .

+6
source share
2 answers

It is possible that when creating C, it was expected that the vertical tab and bell characters would be quite useful as separators inside the code that would be wrap between ASCII and EBCDIC, which should have provided a readable and portable way of marking them. Although you can write

  #define QVTAB "\ 013"
 printf ("Field1" QVTAB "Field2"); 

I do not think that such use was legal in the earliest dialects of C. Also, even if such use is permitted, the use of special macros for the quoted version of characters would probably be considered a little ugly. I know that such things turned out to be necessary in printf format specifiers, but this does not mean that it is enough.

Another thing to keep in mind is that C was not named a programming language that people will use in the coming decades. It was designed to address some urgent needs. K & R would not care if any of the VTAB characters wanted after the 1970s; if their immediate customers would use it for them, that would be the full reason for their inclusion.

+3
source

Correct answer: TELETYPE

He has nada to do with delimiters. My parents worked with big data, and many broadcasters and the Fortune 500 still used punched cards until the 1980s. Remember that most languages ​​were originally intended for input and use on teletext rather than on screen. The printer was intended not only for printing documents such as today. There was no monitor at all . The listing was a display.

With that in mind, vertical tabs were pretty useful. Even after the teletype that my parents used, they quickly developed forms, rewriting only those parts that changed. Because then even text display was too slow!

Fun video: https://www.youtube.com/watch?v=qv5b1Xowxdk

But more important: many, many, many things in modern operating systems are relics of telematics ... not only a vertical tab. We are so used to them that people don’t even think about them anymore, but they are no less strange. I am sure that many do not understand where these conventions came from if they have not been coding since the 70s.

  • 80-column code or email text wrapping?
    Because IBM punch cards were 80 characters wide.

  • Do you use graphics that support upstream encoding, such as Windows bitmaps or any graphics libraries with a source in the lower corner?
    Because teletype machines scroll from bottom to top.

  • Are you using \ n to indicate a new line of text?
    Since \ n means the line that comes from hand-held typewriters before it is used in teletypes.

  • Have you ever sent a message to a friend by writing in / dev / tty under Linux?
    Since TTY is not suitable for teletype.

  • Have you ever told someone to use an existing library instead of reinventing the wheel? Have you ever used a library or wireframe?
    Because, as the old code hangs around. Of course, the benefits outweigh the harm, but libraries built on top of libraries built on top of libraries lead to this creeping addiction, so even when the original library is long gone, everything that has ever been compatible with it makes its agreements live ... and more ... and more ...

These teletype conventions are so deeply rooted in the operating system itself . I fully expect this to always remain until someone writes an operating system from scratch, and even then I'm not sure. There is no doubt why C raised them. Remember that C came after LISP, Forth, COBOL, FORTRAN, Pascal, and even BASIC.

PS Using the bell symbol as a separator would be crazy. Grind grind grind BEEP grind grind BEEEEEEP grind chuka chuka BEEP grind chuka grind grind BEEEP. Whizzzz clunk. Grind grind BEEP ...

+5
source

Source: https://habr.com/ru/post/897017/


All Articles