As required by the project, a program of the Linux/Windows version is developed at the same time. Later, during the actual test, it is found that the behavior between the two versions is somewhat different, which is roughly as follows:
1. Code can be compiled in Linux and compiled in Windows
2. in Linux, the program functions normally and the Linux program functions incorrectly.
# The configuration library uses SVN, and the two systems use the same code
Later, we gradually located the problem and found the problem on the Chinese comments. Further, we found that the end-of-line interpretation is different across platforms.
In fact, in different systems, the line tail operators are interpreted differently:
For example, the Unix line ends with '\ n', the Windows system line ends with "\ r \ n", and the MAC system line ends with' \ R'
It can be seen from the above that in Linux, EOL will be interpreted as carriage return + line feed in windows, while in Linux, it will only be line feed.
To solve this problem, SVN provides the svn: EOL-style property. As long as you set SVN: EOL-style to native, SVN automatically converts EOL to the default format of the current system each time you checkout
Command: SVN propset SVN: EOL-style native file/dir [-r recursion]
In addition, two commands are provided in Linux to solve this problem: dos2unix + unix2dos, which are easy to use. For details, refer to man's description.