From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19174 invoked by alias); 10 Nov 2003 12:37:10 -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 19155 invoked from network); 10 Nov 2003 12:37:09 -0000 Received: from unknown (HELO smtp-relay-8.adobe.com) (192.150.22.8) by sources.redhat.com with SMTP; 10 Nov 2003 12:37:09 -0000 Received: from inner-relay-1.corp.adobe.com (inner-relay-1 [153.32.1.51]) by smtp-relay-8.adobe.com (8.12.10/8.12.10) with ESMTP id hAACafZS023151; Mon, 10 Nov 2003 04:36:47 -0800 (PST) Received: from iplan-mn (iplan-mn.corp.adobe.com [130.248.25.5]) by inner-relay-1.corp.adobe.com (8.12.9/8.12.9) with ESMTP id hAACaa6F021919; Mon, 10 Nov 2003 04:36:36 -0800 (PST) Received: from mn-eljaypc.adobe.com (b-25-155.corp.adobe.com [130.248.25.155]) by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 Patch 1 (built Aug 19 2002)) with ESMTP id <0HO4006PXZ0YW1@iplan-mn.corp.adobe.com>; Mon, 10 Nov 2003 06:36:35 -0600 (CST) Date: Mon, 10 Nov 2003 12:37:00 -0000 From: Eljay Love-Jensen Subject: Re: How to use # inside a macro definition In-reply-to: <1068447850.13711.9.camel@srinagar.india.mentorg.com> X-Sender: eljay@iplan-mn.corp.adobe.com To: Kapileswar Rao , gcc-help@gcc.gnu.org Message-id: <5.2.1.1.0.20031110063242.01560da8@iplan-mn.corp.adobe.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-SW-Source: 2003-11/txt/msg00130.txt.bz2 Hi Kapil, You cannot embed preprocessor directives in a macro expansion. They neither get evaluated at the time of macro definition, nor at the time of instantiation. Perhaps that's unfortunate. But that's the way it is. You'll have to figure out an alternative implementation, such as the one from gertom. Or you could write your own pre-preprocessor. If you do opt for this solution, I recommend using Perl as the engine or use lex (i.e., GNU flex). Instead of writing a parser from scratch -- unless your in it for the sheer fun of tokenizing C/C++. :-) HTH, --Eljay