ANSI C: CPP predefined constants vs. <whoami.h>

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Sat Oct 20 08:31:56 AEST 1984


I don't see how conditional tests for different run-time environments
is going to solve the problem, since there will always be some
unanticipated environments and in any case few programmers are going
to prearrange code to accommodate all known systems; that's a lot of
extra work!

The cleanest approach seems to me to establish a common environment
for portable programs.  The /usr/group C environment standard was
supposed to be one such common environment.  Unfortunately they added
things like the locking call that can't be reasonably provided on all
systems and omitted things like tty ioctls that are needed by many
applications.

The policy in my Division is to target applications for a UNIX System
V environment (minus unique features like real-time IPC) unless it can
be demonstrated that a specific application depends on "native OS"
features in a way that cannot be accessed in the (emulated) UNIX
System V environment.  On foreign systems, someone has to implement
the common environment just once, then the applications come up with
practically no trouble.  This is much easier for the application
developer than trying to accommodate a variety of different
environments directly in his code.

So far I have implementations for:
	UNIX System V (trivial, just directory access routines)
	VAX 4.2BSD
	Gould UTX-32 (preliminary version)
	JHU/BRL PDP-11 UNIX
and am working on one for the Apple ][ (Aztec C under ProDOS).



More information about the Comp.lang.c mailing list