VS15 periodically displays a window

Incompatible line terminations

The line terminations in the following file are not uniform. Normalize line completion?

What does this mean? If normalized, then after some time the same thing appears in another file.

    1 answer 1

    Lines in a text file must be separated. And for this, the world came up with three main ways :

    • LF (ASCII 0x0A) is used in Multics, UNIX, UNIX-like operating systems (GNU / Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga UNIX, RISC OS and others;
    • CR (ASCII 0x0D) is used in 8-bit Commodore machines, TRS-80, Apple II machines, Mac OS up to version 9 and OS-9;
    • CR + LF (ASCII 0x0D 0x0A) is used in DEC RT-11 and most other non-UNIX and non-IBM systems, as well as in CP / M, MP / M (eng.), MS-DOS, OS / 2, Microsoft Windows, Symbian OS, Internet protocols.

    And different editors treat different line feeds differently. For example, notepad does not understand LF translations and shows all the text in one line.

    But the situation is even worse - a mixture of different line breaks in one file. In this case, there are "miracles". For example, the old Delphi compilers did not correctly read the line number in this case and could sometimes show the line with an error in another place (higher than it actually is), but the editor showed the text correctly.

    The studio editor is aware of this problem and deliberately warns. If you work only in Windows and only in a studio compiler, you should use CR + LF. It is natural for Windows.

    Why does it happen that mixed lines are in the file?

    The easiest way is to use a third-party editor, in which the translation of lines is incorrect. And it is enough to add a line like this to the editor, as the problem appears.

    Another way to get such a problem is incorrectly configured git. The fact is that git, being originally a utility from the Linux world, uses LF to translate strings. But when he was ported to video, there were problems with it. Therefore, they made a hack - git can automatically convert - that is, it is stored in the repository with LF, and at checkout it converts to the necessary ones. Good article on this topic .

    • Thanks for the detailed answer - egor