From: Neil Booth <neil@daikokuya.co.uk>
To: Stephen Lindholm <lindholm@CS.Stanford.EDU>
Cc: gcc@gcc.gnu.org
Subject: Re: Change in preprocessor behavior
Date: Mon, 30 Dec 2002 20:54:00 -0000 [thread overview]
Message-ID: <20021230224641.GB12512@daikokuya.co.uk> (raw)
In-Reply-To: <Pine.GSO.4.21.0212301419040.17036-100000@Xenon.Stanford.EDU>
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 <built-in>
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 "<built-in>"
# 1 "<command line>"
# 1 "/tmp/bug.c"
struct command commands[] =
{
{ "quit", quit_command },
{ "help", help_command },
};
$
next prev parent reply other threads:[~2002-12-30 22:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-30 20:53 Stephen Lindholm
2002-12-30 20:54 ` Neil Booth [this message]
2002-12-30 20:54 ` Neil Booth
2002-12-30 20:54 ` Stephen Lindholm
2003-01-02 21:04 ` Devang Patel
2003-01-02 20:42 ` Mike Stump
2003-01-02 21:02 ` Devang Patel
2003-01-04 20:19 ` Zack Weinberg
2002-12-31 10:24 Martin York
2022-06-21 0:34 Dave Blanchard
2022-06-21 7:28 ` Richard Biener
2022-06-21 12:57 ` Dave Blanchard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021230224641.GB12512@daikokuya.co.uk \
--to=neil@daikokuya.co.uk \
--cc=gcc@gcc.gnu.org \
--cc=lindholm@CS.Stanford.EDU \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).