Date: Mon, 28 Feb 2000 17:55:37 +0000 From: Tony Finch <dot@dotat.at> To: bloom@acm.org Cc: freebsd-current@freebsd.org Subject: Re: cpp change breaks ipfw Message-ID: <E12PUOP-000Bn4-00@fanf.eng.demon.net> In-Reply-To: <38BA83C4.8457CC69@acm.org> References: <38B8BAC5.9927A56E@acm.org> <vafem9x1sw3.fsf@lucy.cs.uni-dortmund.de> <38BA6E6D.239DEDB1@acm.org> <vafsnyd4evy.fsf@lucy.cs.uni-dortmund.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Jim Bloom <bloom@acm.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E12PUOP-000Bn4-00>