c/4513: Preprocessor appears broken for the '#' operator

dgillies@graviton.com dgillies@graviton.com
Tue Oct 9 18:56:00 GMT 2001


>Number:         4513
>Category:       c
>Synopsis:       Preprocessor appears broken for the '#' operator
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 09 18:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     dgillies@graviton.com <Donald W. Gillies>
>Release:        unknown-1.0
>Organization:
>Environment:
FreeBSD 4.2
Using builtin specs.
gcc version 2.95.2 19991024 (release)
>Description:
#define STR2(X)          #X
#define MAKESTRING1(X)   STR2(\) STR2(X)
#define MAKESTRING2(X)   STR2(X) STR2(\) 

Just look at the #defines above.  Don't you expect commutative
results when i evaluate MAKESTRING1() and MAKESTRING2() ??

#define CONST 0300

then

MAKESTRING1(CONST) = "\" STR2(CONST)
MAKESTRING2(CONST) = "0300" "\"

I think the preprocessor gets confused when i stringify
the '\' for MAKESTRING1().  The second part of MAKESTRING1()
should be "0300", i believe.

- Don Gillies
Graviton, 858-909-2130
gillies@cs.ubc.ca
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list