RMS comments to X3J11
karl at haddock.UUCP
karl at haddock.UUCP
Fri Jan 16 09:20:24 AEST 1987
In article <1258 at ho95e.UUCP> wcs at ho95e.UUCP (Bill Stewart) writes:
>Doug's suggestion was to have such constants start with _sys_ and _mach_,
>e.g. _sys_43bsd or _mach_vax. As an alternative, why not let
>_sys_ and _machine_ be preprocessor variables, leading to
> #define _sys_ SysVR2
> #define _machine_ u3b2
>and
> #if _machine_ = vax
[I presume that was a typo for "==". --kwzh]
Your suggestion is incomplete. In cpp as currently implemented, your "#if"
would expand into "#if u3b2 == vax" which would be true (!) since tokens with
no definitions are evaluated as zero.
Perhaps you're assuming a hook in cpp to recognize such a comparison and use
the token names instead of their values. (Perhaps you even intended "=", as
opposed to "==", to distinguish this operation? I hope not.) I think such a
rule is too confusing.
Someone else already suggested a variant that I think is more viable:
#define _machine_ "u3b2"
could be tested by some comparison operator. Either "==" or "strcmp(,)==0"
could be used, but since the interpretation is not identical to that of C, I
will suggest a new preprocessor operator "#==".
Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list