ifdef"s for BSD, USG?

mark at cbosgd.UUCP mark at cbosgd.UUCP
Sun May 22 04:53:37 AEST 1983

The "intent" of the VMUNIX ifdef was to indicate that virtual (e.g. lots
of) memory is available.  vi uses it for this as well as sdb.  So it
is reasonable to define VMUNIX on some future version of USG that has
paging, or on a 370.  VFORK normally has its own ifdef.

While I strongly recommend that <stdio.h> or cpp define a constant
to detect the UNIX version (e.g.
	#define USG 6.0
	#define BSD 4.2
), so far neither has done so.  (Anyone out there in either group
listening?)  This would allow
	#if BSD >= 4.2
assuming floating point works in cpp - if not you'd have to omit
the decimal point.

A working kludge is do do
	#include <stdio.h>
	#ifdef L_ctermid
	# define USG
	# define V7
although at any future time this might not be a reliable indicator.
It does work for System V and 4.1BSD.

More information about the Comp.lang.c mailing list