From owner-freebsd-ports Wed Jul 10 16:45:02 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA26501 for ports-outgoing; Wed, 10 Jul 1996 16:45:02 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id QAA26487; Wed, 10 Jul 1996 16:45:00 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id QAA27767; Wed, 10 Jul 1996 16:39:50 -0700 From: Terry Lambert Message-Id: <199607102339.QAA27767@phaeton.artisoft.com> Subject: Re: Q: macro expansion To: dgy@rtd.com (Don Yuniskis) Date: Wed, 10 Jul 1996 16:39:49 -0700 (MST) Cc: freebsd-hackers@freefall.freebsd.org, freebsd-ports@freefall.freebsd.org In-Reply-To: <199607102103.OAA05637@seagull.rtd.com> from "Don Yuniskis" at Jul 10, 96 02:03:54 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-ports@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > Greetings! > I was working on a port last night and stumbled upon this code > fragment (paraphrased here): > #define X 1 > #define Y 2 > X+Y > I was surprised to see that ``X+Y'' was expanded to ``1 +2''. So, > I started digging through ANSI and couldn't seem to locate something > to clearly define this behaviour. > - why the inserted whitespace? > - why no whitespace after `+'? > > Any insight would be appreciated... Because the ANSI C preprocessor didn't want people to use X/**/Y to concatenate X and Y because the people in charge of the decision were weenies with their own axe to grind (and wanted you to use X ## Y instead). __CONCAT(__CONCAT(X,+),Y) ...or take advantage of the whit space insertion ordering: _CONCAT(X,+Y) *bletch*. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.