C portability between non-UNIX operating systems.

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Mon Oct 8 13:00:48 AEST 1984


There are (at least) two things to do to write C code that ports across
operating systems.  First, stick to portable language usage (use "lint"
to check this).  Second, use only those C library routines that exist
across all systems (this is a pretty small subset), or else choose an
environment and port the environment to each target system (this is the
approach I generally use; it involves more work up front but then all
applications port "free" from then on).  Unavoidable system dependencies,
such as routines to get a single character from a keyboard, should be
isolated in separate modules with the SAME interface to the application
but of course a different internal implementation on each system.

Some of the C tutorial texts give good advice about portability, but
others are awful.  Plum-Hall publishes a good set of portability
guidelines (two versions: one for UNIXes and one for general systems).



More information about the Comp.lang.c mailing list