[comp.sources.d] How do you guys write such portable code?

burnette@sas.UUCP (Edmund Burnette) (12/03/86)

Recent comments to the contrary notwithstanding, I have had pretty good
luck taking source right from comp.sources (or wherever), unnsharing it
and compiling it on a couple of systems at work (HP and APOLLO, fyi).
My question is, how do you do it?  Is the author just familiar with all
the sytems the code will be ported to?  Or am I just lucky?  Is there any
written documentation (oh no!) on how to write portable code?  I am not
talking so much about making sure you don't make int/ptr assumptions, etc.,
as all the operating system calls, I suppose.  Thanks.

         -- Edmund
--
 |_o_o|\\   Edmund Burnette
 |. o.| ||  mcnc!rti-sel!sas!burnette
 | .  | ||
 | o  | ||  member of...
 |  . |//   The Software Distillery
 ======     BBS: (919)-471-6436

decot@hpisod2.HP (Dave Decot) (12/17/86)

> Recent comments to the contrary notwithstanding, I have had pretty good
> luck taking source right from comp.sources (or wherever), unnsharing it
> and compiling it on a couple of systems at work (HP and APOLLO, fyi).
> My question is, how do you do it?  Is the author just familiar with all
> the sytems the code will be ported to?  Or am I just lucky?  Is there any
> written documentation (oh no!) on how to write portable code?  I am not
> talking so much about making sure you don't make int/ptr assumptions, etc.,
> as all the operating system calls, I suppose.  Thanks.
> 
>          -- Edmund

Portability is a function of two things: how much attention the software
author paid to being portable, and how much attention the designers of
the target system paid to ensuring easy migration from other environments.

The software you're referring to must have been written with great attention
to using portable (i.e., standard) system calls.

I'm not sure about Apollo, but I know why it was easy to port the software
to an HP-UX system.  It was designed to be compatible with System V, and
to support as many of the 4.2BSD calls as possible while maintaining
compatibility with System V.

Dave Decot
hpda!decot

barber@rabbit1.UUCP (Steve Barber) (12/23/86)

> > ...........  Is there any
> > written documentation (oh no!) on how to write portable code?  I am not
> > talking so much about making sure you don't make int/ptr assumptions, etc.,
> > as all the operating system calls, I suppose.  Thanks.
> > 
> >          -- Edmund
> 

*** CAUTION: Self-serving message follows  ***

There *IS* a book available on how to write portable UNIX programs across
all versions of UNIX (or at least all the ones that we could find at the
time).  It is called "Portable C and UNIX System Programming" by J. E.
Lapin, and it is either available now or will be available very shortly from
Prentice-Hall.

We use the techniques outlined in the book to write all our software and the
results have been terrific.

Disclaimer: I had a part in this book, and Rabbit Software (my employer)
	    gets royalties from its sale.


-- 
Steve Barber    Rabbit Software Corp.
...!ihnp4!{cbmvax,cuuxb}!hutch!barber  ...!psuvax1!burdvax!hutch!barber
(215) 647-0440  7 Great Valley Parkway East  Malvern PA 19355