Just what does "portable" mean?

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Oct 23 04:43:56 AEST 1988


In article <4412 at bsu-cs.UUCP> dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
>Your best bet is to (a) identify the target audience, and (b) pander to
>the whims and fancies of its C compilers.  Then you are "portable
>enough", and that is what really matters.

(a) is not practical.  Nearly every large chunk of C code I've seen
that is more that a few years old is now running on systems that were
unanticpated when it was written.

The point of the C Standard is to serve as a "treaty point" between
C programmers and C compiler vendors.  Obviously it is too soon to
expect ANSI C conformance (there isn't even an ANSI C standard yet).
The only de facto C standards to this point have been K&R 1st Edition
and the AT&T UNIX PCC implementation.  One thing that programmers
concerned about portability should do is make every effort to confine
their use of language features to the common intersection of the de
facto standards and the forthcoming official standard.  (Prototypes
are so useful that some of us recommend coding for both old and new
styles of function declaration, using #if __STDC__ conditionals.
This can also be used to configure the right standard header inclusions.)
There is of course much more to portability than merely following
language rules, but if you DON'T follow the rules your code will
DEFINITELY be non-portable.



More information about the Comp.lang.c mailing list