From owner-freebsd-current Mon Feb 28 9:56: 7 2000 Delivered-To: freebsd-current@freebsd.org Received: from internal.mail.demon.net (internal.mail.demon.net [193.195.224.3]) by hub.freebsd.org (Postfix) with ESMTP id D1BA337B8D0 for ; Mon, 28 Feb 2000 09:55:50 -0800 (PST) (envelope-from fanf@demon.net) Received: from fanf.eng.demon.net (fanf.eng.demon.net [195.11.55.89]) by internal.mail.demon.net with ESMTP id RAA02753; Mon, 28 Feb 2000 17:55:39 GMT Received: from fanf by fanf.eng.demon.net with local (Exim 3.12 #3) id 12PUOP-000Bn4-00; Mon, 28 Feb 2000 17:55:37 +0000 To: bloom@acm.org From: Tony Finch Cc: freebsd-current@freebsd.org Subject: Re: cpp change breaks ipfw In-Reply-To: <38BA83C4.8457CC69@acm.org> References: <38B8BAC5.9927A56E@acm.org> <38BA6E6D.239DEDB1@acm.org> Message-Id: Date: Mon, 28 Feb 2000 17:55:37 +0000 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Jim Bloom wrote: > >That small test works fine, but doesn't solve the problem I was having. Try >this small test case to see my problem: > >#define addr 192.186.2.5 >#define mask 255.255.240.0 > >#define rule(ADDR,MASK) add pass tcp from ADDR ## : ## MASK to any 25 setup >rule(addr,mask) > >This also does not work if addr and mask are defined on the command line. The >problem arises from using another defined value as the string being >concatenated. The concatenation works for constants though. You need to use a two-macro trick similar to the one for stringizing in K&R2: $ gcc -E - #define addr 1.2.3.4 #define mask 5.6.7.8 #define cat_helper(a,b) a ## : ## b #define cat(a,b) cat_helper(a,b) cat(addr,mask) # 1 "" 1.2.3.4:5.6.7.8 $ Tony. -- f.a.n.finch fanf@demon.net dot@dotat.at 455 wetness and warmth for wussies To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message