From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5431 invoked by alias); 30 Dec 2002 22:47:13 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 5424 invoked from network); 30 Dec 2002 22:47:12 -0000 Received: from unknown (HELO monkey.daikokuya.co.uk) (213.152.55.49) by 209.249.29.67 with SMTP; 30 Dec 2002 22:47:12 -0000 Received: from neil by monkey.daikokuya.co.uk with local (Exim 3.36 #1 (Debian)) id 18T8gD-0003Gs-00; Mon, 30 Dec 2002 22:46:41 +0000 Date: Mon, 30 Dec 2002 20:54:00 -0000 From: Neil Booth To: Stephen Lindholm Cc: gcc@gcc.gnu.org Subject: Re: Change in preprocessor behavior Message-ID: <20021230224641.GB12512@daikokuya.co.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-SW-Source: 2002-12/txt/msg01606.txt.bz2 Stephen Lindholm wrote:- > Am I doing something wrong? > > Using this example from the cpp info page: > > #define COMMAND(NAME) { #NAME, NAME ## _command } > > struct command commands[] = > { > COMMAND (quit), > COMMAND (help), > }; > > I get this as expected on an old version of cpp (2.95.3): > > Xenon > cpp test2 > # 1 "test2" > > > struct command commands[] = > { > { "quit", quit_command } , > { "help", help_command } , > }; > > and this on a new version of cpp (3.1): > > thrush:~% cpp test2 > # 1 "test2" > > > struct command commands[] = > { > { #quit, quit ## _command }, > { #help, help ## _command }, > }; I can't reproduce this. In fact, I don't believe you're using GCC 3.1, since the output would be more like that below (note the etc.). FWIW I am confident there are no bugs in # and ## handling in GCC 3.1 and later. Neil. $ cpp --version cpp (GCC) 3.1.1 20020721 (prerelease) Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cpp /tmp/bug.c # 1 "/tmp/bug.c" # 1 "" # 1 "" # 1 "/tmp/bug.c" struct command commands[] = { { "quit", quit_command }, { "help", help_command }, }; $