Date: Wed, 10 Jul 1996 16:39:49 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: dgy@rtd.com (Don Yuniskis) Cc: freebsd-hackers@freefall.freebsd.org, freebsd-ports@freefall.freebsd.org Subject: Re: Q: macro expansion Message-ID: <199607102339.QAA27767@phaeton.artisoft.com> In-Reply-To: <199607102103.OAA05637@seagull.rtd.com> from "Don Yuniskis" at Jul 10, 96 02:03:54 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607102339.QAA27767>