Y
Y
Yuri Pikhtarev2014-08-01 14:45:04
linux
Yuri Pikhtarev, 2014-08-01 14:45:04

Is there a standard for line separator?

What line separator standard do you use? Is there any generally accepted one?
I just found in my project part of the files, where the line break in the Windows style (CRLF) is '\n\r', and the other part in the Linux/Mac style (LF) is '\n'. There was a desire to bring everything to a single standard, of course, immediately preference for LF, but maybe someone has a different opinion? In general, is it worth paying attention to it?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EXL, 2014-08-01
@Exileum

If you have a Git repository, you can do:
With this option, the code obtained from the repositories on all systems will have exactly the same line breaks as in the repository. However, line endings will be converted to LF before being written to the repository. This setting is useful for cross-platform development on Unix-like systems, but can also be used on Windows. And if you urgently need CRLF on Windows, just change the input parameter to true, so when the code is checked out from the repository on the user's machine, there will be CRLF line breaks, while the LF line breaks will remain in the repository itself.

D
Dmitry Guketlev, 2014-08-01
@Yavanosta

Now most of the software can handle both options. If that doesn't bother you, I would. If it interferes, there is a wide range of means to solve this problem. From a simple batch conversion, to post-checkout and pre-check-in processes that will pull files from a repository with a single line ending (let's say Windows if you're on Windows) and put them in a Linux-style repository.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question