Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

prefer windows or unix line ending for code?

I writing code that should compiled and run on both Windows and unix like Linux. I know about difference between line endings, but question is which to prefer for my code? Does it matter? I want it to be consistent - say all my code uses LF only, or is it better CRLF only? Are there critaria for comparing?

If it matters mostly I care for C++ and Python codes

like image 853
zaharpopov Avatar asked Dec 13 '22 19:12

zaharpopov


2 Answers

Use a version control system that's smart enough to ignore line-endings on check-in, and use the correct value for the platform on check-out.

like image 152
Ben Voigt Avatar answered Dec 15 '22 08:12

Ben Voigt


For the code itself, it does not matter. All reasonably modern editors and compilers handle both just as well (I presume you are not using notepad :-) ). Just use the line ending of the main development platform.

like image 41
Andrew Stein Avatar answered Dec 15 '22 07:12

Andrew Stein