From 2198625575165869088
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,f53a695f204bf879
X-Google-Attributes: gidf78e5,public
From: wmm@fastdial.net
Subject: Re: Alternative tokens and token pasting
Date: 2000/07/18
Message-ID: <8kvj7m$4pg$1@nnrp1.deja.com>#1/1
X-Deja-AN: 647433136
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <p6qem4umovx.fsf@informatik.hu-berlin.de>
X-Authentication-Warning: backdraft.briar.org: smap set sender to <news@dejanews.com> using -f
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 963859747 mail2news:21371 mail2news mail2news.demon.co.uk
X-Http-Proxy: 1.1 x55.deja.com:80 (Squid/1.1.22) for client 205.181.152.41
Organization: Deja.com - Before you buy.
X-Article-Creation-Date: Mon Jul 17 18:28:30 2000 GMT
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-MyDeja-Info: XMYDJUIDwmmj16
Newsgroups: comp.std.c++

In article <p6qem4umovx.fsf@informatik.hu-berlin.de>,
  Martin von Loewis <loewis@informatik.hu-berlin.de> wrote:
> What is the meaning of an alternative token (2.5) when occuring in
> token pasting (16.3.3)? Consider
>
> #define paste(a,b) a##b
>
> paste(m,xor)
> paste(xor,=)
>
> Which of these has well-defined behaviour (if any), and what is that
> behaviour? Which is ill-formed with required diagnostic (if any)?

The alternative tokens are preprocessing tokens (they're
preprocessing-op-or-punc, according to 2.12p1, which makes
them preprocessing tokens, according to 2.4).  16.3.3p3 says
that the preprocessing token preceding ## is concatenated
with the preprocessing token following the ##, and that "If
the result is not a value preprocessing token, the behavior
is undefined."

I'd take that to mean that the value of "paste(m,xor)" is
the identifier "mxor", and that "paste(xor,=)" has undefined
behavior.
--
William M. Miller, wmm@fastdial.net
Vignette Corporation (www.vignette.com)


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




