[darcs-users] Line endings
Nimrod A. Abing
nimrod.abing at gmail.com
Tue Jul 15 03:03:40 UTC 2008
On Tue, Jul 15, 2008 at 2:46 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Nimrod A. Abing writes:
>
> > endings pretty well. So does Eclipse, Vim and Emacs. When you use a
> > text editor that does not care about line endings (but preserves them
> > when you save your files), then this silly little problem goes away,
> > yes?
>
> No, it doesn't. There are build tools on Windows that care about line
> endings as much as Make on Unix cares about TAB vs SPC.
Gnu Make only cares about TAB vs SPC at the *start* of the line. You
are right, as I did not take Windows build tools into account there
are probably some tools out there that will choke on EOL's being
different from what they expect. As far as I can tell, most tools in
the current Microsoft tool chain (VS2005) pretty much ignore line
endings. If you're using older versions then YMMV.
Just the other night I was attempting to build gtksharp on Windows XP
using the MS tool chain on top of Cygwin. The line endings for the
source for both C# and C glue code are Unix-style EOL. csc.exe and did
not have a problem with that.
I mostly use the MinGW tool chain myself and on a few occasions I use
the MS tool chain as well. Off the top of my head, I recall the
following tools b0rking because of EOL characters:
1. Bash - Scripts with CRLF EOL's will make it barf, on Cygwin (IIRC,
please correct me if I'm wrong) and Linux/Unix.
2. Solaris Make - Does not like CRLF line endings.
3. Older versions of nmake supplied with Visual Studio
Curiously, cmd.exe will happily run scripts even if it has Unix-style EOL's.
> Unix hackers
> often create automatic editors (such as awk and m4 scripts) that work
> properly on Unix but will happily generate files with mixed line
> endings from Windows files. Not to mention that asking people to even
> think about using a different editor is unacceptable to 99.44% of all
> programmers, with the people who would need to change probably being
> even more recalcitrant.<wink>
If you're on Windows, odds are you are either using Visual Studio or
IntelliJ. These are the "recalcitrant" camp ;) but recent versions of
both IDE's don't really care much about line endings anyway. Those who
deal with both Unix and Windows programming on a daily basis are aware
of the problems of line endings and use tools that do not have a
problem with dealing with different line endings.
> There just aren't any guaranteed wins, except to evolve *all* our
> tools to conform to Unicode. http://www.unicode.org/reports/tr14/
> At *that* point, yes, this silly little problem goes away.
And that's easier than switching editors and using tools that don't
care about line endings? =)
More information about the darcs-users
mailing list