The GCC "End of Text Line" Bug

Polehn, MikeX mikex.polehn@intel.com
Mon Feb 14 13:27:00 GMT 2000


The GCC "End of Text Line" Bug

The End of Text Line Bug has been around for a very long time, exists in a
large number of UNIX like tools (the worst being MAKE, renders the standard
makefile unuseable most of the time when a standard DOS/Windows based editor
is used) and is easy to find an example. Since the PC DOS/Window and GCC
based tools are becoming more integrated (or coexist) though such tools as
SAMBA. etc, and more development tools and/or text editors exist for the
DOS/Windows (edit, notepad, MSVC, etc) environment and more people use these
editors then the UNIX type editors, it makes since that all gcc related
tools understand end-of-lines correctly no matter which common editor type
is used to create or edit the text source file. 

I believe it is becoming more common that people write code which will
compile in both the GCC and the Microsoft environment.

Because of better visually oriented debugging tools (gdb is powerful but not
user friendly, thus time consuming to use), and the complex code that I
write, I prefer to use Microsoft debugger to step through the code where
possible. A compilation works fine under the Microsoft Compiler, however,
just writing the file to an important GCC supported system  (such as LINUX
), will not compile correctly. A C Compilation will generally result in
errors for no apparent reason (at least not by viewing the source code on a
low cost PC editor). However, I have written a DOS program which just
changes the DOS/Windows end-of-lines to that used by the UNIX editors. After
filtering the file with this, the file then compiles correctly. Fortunately
for me, I don't need to convert the other way since the code with the UNIX
line terminators compiles with no problems in the Microsoft environment. 

It is easy to find an example since most C files of larger then about 500
lines almost always have a compilation error under gcc, so just convert some
files to have DOS type end of lines and compile. 

There are a large number of times in which inexperienced people will just
have to conclude that the gcc compiler is buggy since their DOS file copied
to a gcc environment, maybe just using a 1.44 floppy, will not compile
properly for no apparent reason. This substantially reduces the credibly of
systems such as LINUX which uses gcc. Therefor I consider this a bug where
some people would consider it a feature to be able to compile for both
end-of-line formats. 

I believe the compiler should work correctly for all these end-of-line
(single line) conditions to meet most editing environment needs:

<cr>
<lf>
<lf><cr>
<cr><lf>
<eof>

Mike Polehn




More information about the Gcc-bugs mailing list