gwyn@brl-smoke.ARPA (Doug Gwyn ) (01/14/87)
In article <1258@ho95e.UUCP> wcs@ho95e.UUCP (Bill Stewart 1-201-949-0705 ihnp4!ho95c!wcs HO 2G202) writes: >... why not let >_sys_ and _machine_ be preprocessor variables, leading to > #define _sys_ SysVR2 > #define _machine_ u3b2 >and > #if _machine_ = vax Because the last line has no meaning unless the symbol `vax' is also macro defined to something like an integer constant (further, all possible system symbols would have to be assigned different constant values). (The `=' is not a string compare as in Bourne shell scripts.) Nice try, though.
gwyn@brl-smoke.ARPA (Doug Gwyn ) (01/14/87)
In article <5513@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes: >In article <1258@ho95e.UUCP> wcs@ho95e.UUCP (Bill Stewart 1-201-949-0705 ihnp4!ho95c!wcs HO 2G202) writes: >> #if _machine_ = vax >(The `=' is not a string compare as in Bourne shell scripts.) Actually, `=' makes no sense in this context and `==' isn't a string compare. I suppose one could consider making `=' a token compare in preprocessor expressions, but that probably runs into difficulties with the "phases of translation" approach we took to support tokenized preprocessing.
wcs@ho95e.UUCP (01/19/87)
In article <5513@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes: >In article <1258@ho95e.UUCP> wcs@ho95e.UUCP (Bill Stewart 1-201-949-0705 ihnp4!ho95c!wcs HO 2G202) writes: >>... why not let >>_sys_ and _machine_ be preprocessor variables, leading to >> #define _sys_ SysVR2 >> #define _machine_ u3b2 >>and >> #if _machine_ = vax > >Because the last line has no meaning unless the symbol `vax' is >also macro defined to something like an integer constant (further, all >possible system symbols would have to be assigned different constant >values). (The `=' is not a string compare as in Bourne shell scripts.) > >Nice try, though. Oh, well, it looked good. As you point out (and Larry Rosler did by mail), = is comparing integers, not strings. Back to suggestions of _mach_vax. -- # Bill Stewart, AT&T Bell Labs 2G-202, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs