Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c,comp.bugs.4bsd Subject: Re: C preprocessor question Message-ID: <5259@mimsy.UUCP> Date: Sun, 1-Feb-87 21:03:15 EST Article-I.D.: mimsy.5259 Posted: Sun Feb 1 21:03:15 1987 Date-Received: Sun, 1-Feb-87 23:36:53 EST References: <4136@brl-adm.ARPA> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 49 Xref: mnetor comp.lang.c:920 comp.bugs.4bsd:170 The example was: >>#define GROUP(group,subgroup) (((group) << 8) | (subgroup)) >>#if GROUP(0,0) >>#endif In article <4136@brl-adm.ARPA> moss@BRL.ARPA (Gary S. Moss (SLCBR-VLD-V)) writes: >The pre-processor defined macros are not evaluated by CPP. Some are; others are confused. >In other words, "#if GROUP(0,0)" is illegal because GROUP(0,0) has no value. Yet #define GROUP 1 #if GROUP ... #endif is legal, and works. The 4.3BSD cpp gets very confused when handed #define I(a) a #if I(1) gorp #endif Compiling this with `cc -E' produces # 1 "xx.c" xx.c: 4: syntax error 1 gorp #endif xx.c: 5: missing endif which is hardly proper behaviour. If parameterised macros are not to be evaluated, this should be either a syntax error (`#if ') or a false conditional (`#if ' is now treated as is `#if 0'). If they are to be evaluated, this should be equivalent to `#if 1', and the original example should have worked too. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: seismo!mimsy!chris ARPA/CSNet: chris@mimsy.umd.edu