[net.micro] Need help/advice re C compiler and portability

pvk@ixn5f.UUCP (Pat Kauffold) (05/09/85)

I am looking for advice and experience with porting C programs from
a PC/DOS or MS/DOS (IBM PC or PC6300) environment to a Unix V
environment (and possibly downward to a CP/M environment?).

I want to do all development on the PC6300 and port to other machines,
primarily Unix V environments (PC7300, 3B2, PDP-11), and secondarily,
to CP/M environments.

Are there any commercially available C compilers for MS/DOS which 
require a minimum of source conversion to port to a Unix V environment?  

I would like to be able to port with no changes; I consider changes
to 5% or more code to be unacceptable.  I am not as concerned about
internal efficiency of the load modules as I am about programmer
efficiency.

Please reply to: 	Pat Kauffold
			AT&T Bell Labs
			IX 1F-373
			1200 E. Warrenville Road
			Naperville IL 60566

			ixn5f!pvk
			ixe5n!pvk

daveb@rtech.ARPA (Dave Brower) (05/12/85)

> I am looking for advice and experience with porting C programs from
> a PC/DOS or MS/DOS (IBM PC or PC6300) environment to a Unix V
> environment (and possibly downward to a CP/M environment?).

I have had very little difficulty moving code created for Lattice, C-86
or Mark Williams up to the Unix PCC.  I'd expect similar results from
Wizard or DeSmet or Eco.  All are generally compatible subsets of Unix
C; Lint will catch 90% of the problems.  One annoying hassle is the case
insensitivity of the MSDOS linker; this can let you be sloppy about
spelling across files, since "FooBar" and "foobar" will resolve to the
same location.   Other changes are typically in terminal handling and
support of the multiple process environment.  You don't want to use
fixed names for temporary files since another instantiation of your
program might also be running (hence the need to use mktemp() or
eqvivalent).

It is more difficult moving from Unix to dink machines, because people
tend to use Unix, PCC, or Reisner preprocessor specific tricks, or are
too generous with machine resources that don't exist on a PC like memory
and disk bandwidth :-).  *BUT* if I were doing MSDOS development, I'd
probably try to develop the program on UNIX, then move it down to the PC
after all the "work" was done.  You'd need to be conscious of the PC
target compiler and fanatically careful about the portability issues. 
Having all of the UNIX tools (make, grep, awk, sort, uniq, sed, lint, a
programmable shell) is a blessing not to be easily dismissed. An MSDOS
make from PolyTron, Lattice or the one recently posted to net.sources
would keep working on the PC from being a total nightmare.  Getting the
Public Domain CPP as a frontend for whatever compiler you would also
help.

CP/M is for practical purposes dead.  While I still have a Kaypro,
useable for file transfer, I'm not even trying to keep my code running
on it.  I formerly used BDS-C, Softworks-C and Aztec.  BDS is both the
most at home on CP/M and the least portable to other systems, being the
most restrictive subset of the full language.  As a sweeping generality,
ALL of the CPM compilers are less portable in any direction than the
MSDOS compilers.  And because people spend time leaning the intricacies
of a particular implementation, they tend to be more religious about
sticking with it.  (Expect to get widely conflicting advice.)

MSDOS programmers tend to be more willing to change compilers based on
the number of bugs in this weeks release or the results of their
favorite benchmark.  Most of the people I know chose their MSDOS
compiler as follows:

Lattice:  Best support of mixed memory models.  The inevitable choice,
like IBM.

C-86:  Library source supplied, reliable.  George Eberhard is one of the
nicest guys in the business.  In everybody's top two.

DeSmet:  Cheap and it works.

Mark Williams:  Hot benchmarks, most like Unix, but alleged to be buggy
in early releases.

I have no first or second hand experience with Microsoft 3.x, Wizard or
Eco-C for either MSDOS or CP/M.  Your milage may vary.

[General disclaimer:  These opinions are my own.  Nobody else would want
them.  Specific disclaimer:  I haven't been working on MSDOS in nearly a
year, so I don't know how current versions really compare.]
-- 
{amdahl|dual|sun|zehntel}\			| Time flies like an arrow,
{ucbvax|decvax}!mtxinu    >!rtech!daveb 	| Fruit flies like bananas.
ihnp4!phoenix ___________/