From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17107 invoked by alias); 23 Nov 2001 23:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 17093 invoked by uid 71); 23 Nov 2001 23:36:01 -0000 Date: Mon, 19 Nov 2001 20:36:00 -0000 Message-ID: <20011123233601.17092.qmail@sourceware.cygnus.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: 'Zack Weinberg' Subject: Re: preprocessor/4923: Concatenation appears to handle whitespace incorrectly Reply-To: 'Zack Weinberg' X-SW-Source: 2001-11/txt/msg00569.txt.bz2 List-Id: The following reply was made to PR preprocessor/4923; it has been noted by GNATS. From: 'Zack Weinberg' To: "Baum, Nathan I" Cc: "'gcc-gnats@gcc.gnu.org'" Subject: Re: preprocessor/4923: Concatenation appears to handle whitespace incorrectly Date: Fri, 23 Nov 2001 15:33:56 -0800 On Fri, Nov 23, 2001 at 07:32:29PM -0000, Baum, Nathan I wrote: > > >This would be a lot of work and frankly I don't see the point. Show > >me real code that desperately needs this functionality and I'll show > >you how to fix it so it's standard conforming C. > > As far as I tell, I have no use for this feature, myself. Somebody wanted to > know how they could do something like: > > #define CONCAT(a,b) a ## b > #define STRCAT(a,b) #CONCAT(a,b) > #include STRCAT(PREFIX, foobar.h) > > Naturally, this didn't work because of the macros' order of evaluation. On > the other hand: > > #define STRCAT(a,b) #a #b > #include STRCAT(PREFIX, foobar.h) Given the presence of "foobar.h", I suspect someone is trying to glue together an #include directive. And, indeed, #include "prefix" "foobar.h" is invalid - C99 6.10.3 contemplates only #include directives which (after being completely macro expanded) take the forms # include "pseudo-string-constant" # include (pseudo-string-constant because they don't obey quite the same rules as string constants; in particular, escape sequences are not honored.) There really isn't a way around this - I'd support an extension which permitted string constant concatenation in #include but the semantics would have to be carefully hammered out. zw