220 8735 <52DD090A.6070506@eudoxos.de> article
Path: news.gmane.org!not-for-mail
From: Roland Bock <rbock@eudoxos.de>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: "Raw" preprocessor macro arguments
Date: Mon, 20 Jan 2014 12:31:22 +0100
Lines: 245
Approved: news@gmane.org
Message-ID: <52DD090A.6070506@eudoxos.de>
References: <c0398870-b265-4d02-a814-ad84a472520c@isocpp.org> <3fc9f495-0bb2-4432-bb79-385fe222feab@isocpp.org> <52DCE5B4.8090704@eudoxos.de> <86a02b59-8c7f-4478-9f69-0ff53660c4eb@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------080406090704020109010709"
X-Trace: ger.gmane.org 1390217487 2281 80.91.229.3 (20 Jan 2014 11:31:27 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 20 Jan 2014 11:31:27 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCO7PYWVVELRBEMS6SLAKGQE63ZVNZQ@isocpp.org Mon Jan 20 12:31:34 2014
Return-path: <std-proposals+bncBCO7PYWVVELRBEMS6SLAKGQE63ZVNZQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-fa0-f69.google.com ([209.85.161.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCO7PYWVVELRBEMS6SLAKGQE63ZVNZQ@isocpp.org>)
	id 1W5D4m-0000ae-9A
	for gclcip-std-proposals@m.gmane.org; Mon, 20 Jan 2014 12:31:32 +0100
Original-Received: by mail-fa0-f69.google.com with SMTP id a10sf5131974fad.8
        for <gclcip-std-proposals@m.gmane.org>; Mon, 20 Jan 2014 03:31:31 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=Ql+48ugL7qRbOUy4UXbXGEltOaDX5LQYqVMYLm2Ej28=;
        b=Eme+rbzfvg7SDgRYmWDTHJ1DCZeiCpy0U/lTFIM9mll8+jzKAQ1OemMcqk4kIHCDQl
         ba2xdSF2b7NUg/bRkQgrqJZNt3ia76zlpwhyWoF02UbJmYS2gluj3DpVI7VAXSbh59Jg
         7H23waJg6D2cPMy/wqLUx0H2dPY+DRjkzLXbLOmjEs6ALE4QMugWiftwmCvKJonkWCMB
         ug5hIecuEQErJ+qCoGCJAtG6l+yjx02IBC5qHaQN2tzUAfoOZJNlUDR4FzuQTwmr0Sjo
         2xyC1gCGquXj+sDXmii2eVgq9o26TvHTPRDzaIy01TiAJfL7bkpZWJPnL8ur3HX2a614
         r5Tg==
X-Gm-Message-State: ALoCoQk61QJZDgVEG0BI0oNhm9D3pbm++NRvzWoTWnBHmiQlg28qkMRqFy60ylgLjDGliw/DPdWG
X-Received: by 10.204.53.11 with SMTP id k11mr3938076bkg.6.1390217490461;
        Mon, 20 Jan 2014 03:31:30 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.8.6 with SMTP id n6ls472030wia.32.canary; Mon, 20 Jan 2014
 03:31:29 -0800 (PST)
X-Received: by 10.15.24.72 with SMTP id i48mr1870237eeu.74.1390217489522;
        Mon, 20 Jan 2014 03:31:29 -0800 (PST)
Original-Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.126.171])
        by mx.google.com with ESMTPS id 43si1807980eeh.73.2014.01.20.03.31.29
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Mon, 20 Jan 2014 03:31:29 -0800 (PST)
Received-SPF: neutral (google.com: 212.227.126.171 is neither permitted nor denied by best guess record for domain of rbock@eudoxos.de) client-ip=212.227.126.171;
Original-Received: from [172.30.200.118] ([194.97.158.70])
	by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis)
	id 0MUPVW-1Vx49p0e7G-00R4me; Mon, 20 Jan 2014 12:31:23 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To: <86a02b59-8c7f-4478-9f69-0ff53660c4eb@isocpp.org>
X-Provags-ID: V02:K0:PDk///FwrIaMWTsq5Xkr3vuf8qoGw5GQP1mEHHe++fo
 PCzdtmI+OQsCMG7I7+c80V4bbnUV/4xqSxQEU38LRWFQujXe0L
 MqLoQOUrjS1oRIRrJ8WJHuQEDP2/nL66WOdzHBOnYym/7Bqy51
 PjUlwsFrPwXq22PEQdgrKFXnUE+5+wfwF8JAgUBHpi/KstOaLE
 PJOStv1JXwx7G1VwZbT8J8w68Ty3IDn7j9e/mAb8iT7/kOzmqm
 SlMbMJ7XxeHaauxgqsm+441eqcRmvjjbh5rBdpCHbrV1lVGnlF
 ZUpRcOUT8WkNDCQo7BCZB9/nourRHi63LwIcnKq6kjvSs4v/Fr
 SH+GnV3FIefwp1WfV+S0=
X-Original-Sender: rbock@eudoxos.de
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 212.227.126.171 is neither permitted nor denied by best guess
 record for domain of rbock@eudoxos.de) smtp.mail=rbock@eudoxos.de
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:8735
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8735>

This is a multi-part message in MIME format.
--------------080406090704020109010709
Content-Type: text/plain; charset=UTF-8

Yes, sorry, was too quick...

On 2014-01-20 11:49, Vittorio Romeo wrote:
> This is not what I expect, since it also prints the parenthesis. 
> The solution would be having a "variadic stringify function"
> |
> #define SSVPP_IMPL_STRINGIFYWITHCOMMAS(mIdx, mData, mArg)   SSVPP_STRINGIFY(mArg)SSVPP_IF(mIdx, ", ", SSVPP_EMPTY())
> #define SSVPP_STRINGIFYWITHCOMMAS(...)                      SSVPP_FOREACH(SSVPP_IMPL_STRINGIFYWITHCOMMAS, SSVPP_EMPTY(), __VA_ARGS__)
> |
>
> However, it needs to be explicitly called, and the "raw argument"
> consistency fails here.
>
> On Monday, 20 January 2014 10:00:36 UTC+1, Roland Bock wrote:
>
>     On 2014-01-20 09:53, Vittorio Romeo wrote:
>     > http://ideone.com/B5hVDS
>     >
>     > This example shows un-intuitive behavior.
>     > The "raw argument" is actually passed as multiple arguments, and
>     does
>     > not expand correctly.
>     >
>     > I would expect the program to print "1, 2, 3" or "1,2,3" -
>     instead, it
>     > fails to compile.
>     >
>     Did not check the other examples, but how about this:
>
>     #define RAW(...) (__VA_ARGS__)
>
>
>     http://ideone.com/DXXOXP (works as expected)
>
> -- 
>  
> ---
> You received this message because you are subscribed to the Google
> Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--------------080406090704020109010709
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3DUTF-8" http-equiv=3D"Content-Type=
">
  </head>
  <body text=3D"#000000" bgcolor=3D"#FFFFFF">
    <div class=3D"moz-cite-prefix">Yes, sorry, was too quick...<br>
      <br>
      On 2014-01-20 11:49, Vittorio Romeo wrote:<br>
    </div>
    <blockquote
      cite=3D"mid:86a02b59-8c7f-4478-9f69-0ff53660c4eb@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr">This is not what I expect, since it also prints the
        parenthesis.=C2=A0<br>
        The solution would be having a "variadic stringify function"
        <div>
          <div class=3D"prettyprint" style=3D"background-color: rgb(250,
            250, 250); border: 1px solid rgb(187, 187, 187); word-wrap:
            break-word;"><code class=3D"prettyprint">
              <div class=3D"subprettyprint">
                <pre><span style=3D" color:#ef2672;"><span style=3D"color: =
#800;" class=3D"styled-by-prettify">#define</span></span><span style=3D" co=
lor:#3e3d32;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span></span><span style=3D" color:#ef2672;"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">SSVPP_IMPL_STRINGIFYWITHCOMMAS</span></span><spa=
n style=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span></span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">mIdx</span><span style=3D" color:#e6e5e2;"><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span></span><span style=3D" color:#3e=
3d32;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">mData</span>=
<span style=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span></span><span style=3D" color:#3e3d32;"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span style=
=3D"color:=20
#000;" class=3D"styled-by-prettify">mArg</span><span style=3D" color:#e6e5e=
2;"><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span></spa=
n><span style=3D" color:#3e3d32;"><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> =C2=A0 </span></span><span style=3D" color:#ef2672;"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">SSVPP_STRINGIFY</span=
></span><span style=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">mArg</span><span style=3D" color:#e6e5e2;"><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">)</span></span><span styl=
e=3D" color:#ef2672;"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">SSVPP_IF</span></span><span style=3D" color:#e6e5e2;"><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span></span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">mIdx</span><span style=3D" color:#e=
6e5e2;"><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><=
/span><span st
yle=3D" color:#3e3d32;"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span></span><span style=3D" color:#e6db74;"><span style=3D"color:=
 #080;" class=3D"styled-by-prettify">",</span></span><span style=3D" color:=
#3e3d32;"><span style=3D"color: #080;" class=3D"styled-by-prettify"> </span=
></span><span style=3D" color:#e6db74;"><span style=3D"color: #080;" class=
=3D"styled-by-prettify">"</span></span><span style=3D" color:#e6e5e2;"><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">,</span></span><span =
style=3D" color:#3e3d32;"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span></span><span style=3D" color:#ef2672;"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">SSVPP_EMPTY</span></span><span style=
=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">())</span></span></pre>
                <pre><span style=3D" color:#ef2672;"><span style=3D"color: =
#800;" class=3D"styled-by-prettify">#define</span></span><span style=3D" co=
lor:#3e3d32;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span></span><span style=3D" color:#ef2672;"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">SSVPP_STRINGIFYWITHCOMMAS</span></span><span sty=
le=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">(...)</span></span><span style=3D" color:#3e3d32;"><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span></span><span style=3D" col=
or:#ef2672;"><span style=3D"color: #000;" class=3D"styled-by-prettify">SSVP=
P_FOREACH</span></span><span style=3D" color:#e6e5e2;"><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span></span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">SSVPP_IMPL_STRINGIFYWITHCOMMAS</span><s=
pan style=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span></span><span style=3D" col
or:#3e3d32;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan></span><span style=3D" color:#ef2672;"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">SSVPP_EMPTY</span></span><span style=3D" color:#e=
6e5e2;"><span style=3D"color: #660;" class=3D"styled-by-prettify">(),</span=
></span><span style=3D" color:#3e3d32;"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">__VA_ARGS__</span><span style=3D" color:#e6e5e2;"><=
span style=3D"color: #660;" class=3D"styled-by-prettify">)</span></span></p=
re>
              </div>
            </code></div>
          <br>
          However, it needs to be explicitly called, and the "raw
          argument" consistency fails here.<br>
          <br>
          On Monday, 20 January 2014 10:00:36 UTC+1, Roland Bock wrote:
          <blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
            0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On
            2014-01-20 09:53, Vittorio Romeo wrote:
            <br>
            &gt; <a moz-do-not-send=3D"true"
              href=3D"http://ideone.com/B5hVDS" target=3D"_blank"
              onmousedown=3D"this.href=3D'http://www.google.com/url?q\75htt=
p%3A%2F%2Fideone.com%2FB5hVDS\46sa\75D\46sntz\0751\46usg\75AFQjCNFN00duigtq=
jYQCPYDVTUIs2QmR1w';return
              true;"
              onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A=
%2F%2Fideone.com%2FB5hVDS\46sa\75D\46sntz\0751\46usg\75AFQjCNFN00duigtqjYQC=
PYDVTUIs2QmR1w';return
              true;">http://ideone.com/B5hVDS</a>
            <br>
            &gt;
            <br>
            &gt; This example shows un-intuitive behavior.
            <br>
            &gt; The "raw argument" is actually passed as multiple
            arguments, and does
            <br>
            &gt; not expand correctly.
            <br>
            &gt;
            <br>
            &gt; I would expect the program to print "1, 2, 3" or
            "1,2,3" - instead, it
            <br>
            &gt; fails to compile.
            <br>
            &gt;
            <br>
            Did not check the other examples, but how about this:
            <br>
            <br>
            #define RAW(...) (__VA_ARGS__)
            <br>
            <br>
            <br>
            <a moz-do-not-send=3D"true" href=3D"http://ideone.com/DXXOXP"
              target=3D"_blank"
              onmousedown=3D"this.href=3D'http://www.google.com/url?q\75htt=
p%3A%2F%2Fideone.com%2FDXXOXP\46sa\75D\46sntz\0751\46usg\75AFQjCNE0QEFIl6Ya=
qmdo5g6xSgGW64vK2Q';return
              true;"
              onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A=
%2F%2Fideone.com%2FDXXOXP\46sa\75D\46sntz\0751\46usg\75AFQjCNE0QEFIl6Yaqmdo=
5g6xSgGW64vK2Q';return
              true;">http://ideone.com/DXXOXP</a> (works as expected)
            <br>
          </blockquote>
        </div>
      </div>
      -- <br>
      =C2=A0<br>
      --- <br>
      You received this message because you are subscribed to the Google
      Groups "ISO C++ Standard - Future Proposals" group.<br>
      To unsubscribe from this group and stop receiving emails from it,
      send an email to <a class=3D"moz-txt-link-abbreviated" href=3D"mailto=
:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org=
</a>.<br>
      To post to this group, send email to <a class=3D"moz-txt-link-abbrevi=
ated" href=3D"mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>=
..<br>
      Visit this group at <a moz-do-not-send=3D"true"
        href=3D"http://groups.google.com/a/isocpp.org/group/std-proposals/"=
>http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br>
    </blockquote>
    <br>
  </body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--------------080406090704020109010709--

.
