From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26031 invoked by alias); 22 Nov 2002 17:43:11 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 26024 invoked from network); 22 Nov 2002 17:43:09 -0000 Received: from unknown (HELO hotmail.com) (64.4.8.94) by sources.redhat.com with SMTP; 22 Nov 2002 17:43:09 -0000 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 22 Nov 2002 09:43:09 -0800 X-Originating-IP: [66.170.45.178] From: "Buddy Lott" To: Subject: RE: CPP (preprocessor) quandry Date: Fri, 22 Nov 2002 09:43:00 -0000 Message-ID: <583E84A77A2FCB4F967E6CD9B0CA4AF74E4905@nt-server.kreuter> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-Reply-To: <4.3.2.7.2.20021122105625.00b525e8@iplan-mn.corp.adobe.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-OriginalArrivalTime: 22 Nov 2002 17:43:09.0730 (UTC) FILETIME=[9F499820:01C2924E] X-SW-Source: 2002-11/txt/msg00164.txt.bz2 I can't think of a way to get around this, but maybe if you explain what purpose this solves (in other wordes, why use the macro) I could think of a way to accomplish the same thing. One what that comes to mind: Typedef enum { a,b,c} EnumWhatever; MkFoo(Whatever) > -----Original Message----- > From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On > Behalf Of Eljay Love-Jensen > Sent: Friday, November 22, 2002 12:17 PM > To: gcc-help@gcc.gnu.org > Subject: CPP (preprocessor) quandry > > Here's a simplified example of my quandry: > #define MkFoo(y) typedef y Foo > > Users were happy with this solution, doing things like... > MkFoo(unsigned char); > ...or... > MkFoo(signed long int); > ...as they needed. > > But then one day, a programmer needed this. But the following is No > Good... > MkFoo(enum {a,b,c}); > ...since the preprocessor thinks the comma belongs to it. > > So the usual way of embedding commas as a macro parm is by another set of > parens: > MkFoo((enum {a,b,c})); > > However, that expands to... > typedef (enum {a,b,c}) Foo; > ...which is still No Good. > > What is the preprocessor trick to strip out the extra parens? > > Or is there an inverse of stringification (passing the parm in as a quoted > string and then stripping the quotes would be acceptable, if possible)? > > Don't suggest templates. Not appropriate for this code base. > > Thanks, > --Eljay > (I hate macros.)