From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2140 invoked by alias); 30 Mar 2008 19:28:01 -0000 Received: (qmail 2130 invoked by uid 22791); 30 Mar 2008 19:28:01 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 30 Mar 2008 19:27:27 +0000 Received: (qmail 4275 invoked from network); 30 Mar 2008 19:27:25 -0000 Received: from unknown (HELO ?192.168.44.103?) (nathan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Mar 2008 19:27:25 -0000 Message-ID: <47EFE996.8070608@codesourcery.com> Date: Sun, 30 Mar 2008 19:28:00 -0000 From: Nathan Sidwell User-Agent: Thunderbird 2.0.0.12 (X11/20080227) MIME-Version: 1.0 To: Daniel Lohmann CC: Harvey Chapman , MSX to GCC Subject: Re: C++ Macros, ##, and :: References: <8FC313E8-5249-4F2A-A98E-13927BDDEB76@3gfp.com> <96F86A13-03E0-48EC-B94E-A306A8242421@informatik.uni-erlangen.de> In-Reply-To: <96F86A13-03E0-48EC-B94E-A306A8242421@informatik.uni-erlangen.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-03/txt/msg00319.txt.bz2 Daniel Lohmann wrote: > > On 27.03.2008, at 21:59, Harvey Chapman wrote: >> Why does ... >> >> #define MT(name) { name::Type, name::Create } >> >> work, and ... >> >> #define MT(name) { name##::Type, name##::Create } >> >> does not? > AFAIK :: is a delimiter to the preprocessor (similar to ,). Hence, the > first one should be portable; the latter one does not work as the > result of the concatenation has to be a token. > > To clarify this in the code , you could even write: > >> #define MT(name) { name :: Type, name :: Create } you are correct on all points. '::' is a token in its own right. nathan. -- Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery