Mail Archives: djgpp/1997/05/29/06:06:18
I've been trying to compile a large body of C source using DJGPP and
note that things which compile fine on my LInux box (gcc 2.7.2.1, but
I've also compiled it in the past with versions of gcc as old as 2.5.8)
emit tons of errors on djgpp 2.0.1, requiring massive editing of the
source code. Let it be said that this source code is compiled in another
environment all the time using SCO's Unix==>DOS cross-compile tools, so
in general it is portable between Unix and DOS.
Much of this code is over a decade old, and as such contains some truly
gross coding practice. This awful stuff is hidden behind a set of ifdefs
so for modern compilers we can replace it with something less gross. I
don't particularly want to show examples of it here, but let it suffice
to say it is an abuse of the C preprocessor. The modern version uses the
capability of modern ANSI compilers to concatenate adjacent string
constants into a single entity, and the old version was a hack-ish way
of abusing the preprocesor to accomplish the same result back when
compilers didn't provide that capability.
GCC thinks the old stuff is a serious syntax error. However, on Linux I
can just set the define the appropriate way so as to hide the gross
stuff, and it compiles just fine. On DJGPP, given the same set of
defines, GCC spews bazillions of error messages about syntax errors.
The only way I've found so far to avoid the problem is to edit several
dozens of files, removing the "old" code completely. Definitely not a
desirable option, as that interferes with having one set of sources
for all platforms.
What I don't get is why the DOS version is so picky and why the Linux
one isn't. Using -traditional only seems to make it worse. Anyone got
any good ideas?
Thanks!
Fred
--
---- Fred Smith -- fredex AT fcshome DOT stoneham DOT ma DOT us -----------------------------
But God demonstrates his own love for us in this:
While we were still sinners,
Christ died for us.
------------------------------- Romans 5:8 (niv) ------------------------------
- Raw text -