pre#defines for system and machine (was: RMS comments to X3J11)

vrs at omssw2.UUCP vrs at omssw2.UUCP
Mon Jan 26 17:15:35 AEST 1987


In article <3952 at utcsri.UUCP> flaps at utcsri (Alan J Rosenthal ) writes:
>In article <5497 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn ) writes:
>>For example, the machine I'm preparing this response on would
>>predefine _sys_bsd43 and _mach_vax.
>
>Why _sys_bsd43 and not _sys_bsd but _mach_vax but not _mach_vax8600 (or
>whatever)?

I think there is entirely too much emphasis placed on high level symbols
(like bsd) where low level symbols (like SIGTSTP) are needed.  I often
see code that reads
	#ifdef SYSV
		ioctl(fd, TCGETA, &term);
	#endif
when it ought (in my opinion) to read
	#ifdef TCGETA
		ioctl(fd, TCGETA, &term);
	#endif
so that the test is for the existence of the feature, not some implicit
assumption about the features present in a particular system.  I'm not
familiar with 4.3, but I'd bet most of the features that distinguish it
from 4.2 also define lower level symbols which could be checked for instead
of _sys_bsd43.  Similarly, I usually don't really care if it is a VAX --
I care about the word order or some other low level features.  Making the
code dependant on these low level feature defines improves portability
immensely, because now I can run on any system with the feature (say TCGETA
instead of only on a particular OS (SYSV).  (If my system has job control,
the code will use it, even if the OS isn't BSD).
-- 
                 Vincent R. Slyngstad
             Xenix Evaluation Engineering
            Intel Corporation (omssw2!vrs)
  "I am not now, nor have I ever been, a gloom cookie."
What episode of a popular TV show is the above line from?



More information about the Comp.lang.c mailing list