From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28374 invoked by alias); 4 Apr 2013 06:41:46 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28279 invoked by uid 48); 4 Apr 2013 06:41:41 -0000 From: "stelek at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/56825] Preprocessor does not expand macro correctly if it is an argument and argument of a macro contains ## Date: Thu, 04 Apr 2013 06:41:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: stelek at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg00361.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56825 --- Comment #4 from Evgeny Televitckiy 2013-04-04 06:41:38 UTC --- Ye, I thought it was something along those lines. Thanks for the clarification, now I understand the reason why this paragraph appear in standard. Yet, appealing to the end of your comment. I would expect ,##x construct to be an exception, especially that it has a totally different meaning then concatenating # or stringifying ##. Clearly one would expect: #define E3N(n, ar...) E3NI(_, ##ar, n, n, n) #define E3NI(a0, a1, a2, a3, ...) a1, a2, a3 #define USE_E3_ARG_R(n, ar...) (E3N(n, ar)) #define USE_E3_ARG_W(n, ar...) (E3N(n, ##ar)) and used: USE_E3_ARG_R(5, USE_E3_ARG_R(6, 7)); USE_E3_ARG_W(5, USE_E3_ARG_W(6, 7)); To produce the same result... In addition I wanted to add that it is not some virtual problem. I actually spent 3 hours of my life in that macro hell, trying to understand what went wrong with that macro,