220 8734 <86a02b59-8c7f-4478-9f69-0ff53660c4eb@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vittorio Romeo <vittorio.romeo.vee@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: "Raw" preprocessor macro arguments
Date: Mon, 20 Jan 2014 02:49:08 -0800 (PST)
Lines: 163
Approved: news@gmane.org
Message-ID: <86a02b59-8c7f-4478-9f69-0ff53660c4eb@isocpp.org>
References: <c0398870-b265-4d02-a814-ad84a472520c@isocpp.org> <3fc9f495-0bb2-4432-bb79-385fe222feab@isocpp.org>
 <52DCE5B4.8090704@eudoxos.de>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_78_6611027.1390214948436"
X-Trace: ger.gmane.org 1390214943 4463 80.91.229.3 (20 Jan 2014 10:49:03 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 20 Jan 2014 10:49:03 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCO3NDEYZQHRBJP66OLAKGQENYH56TY@isocpp.org Mon Jan 20 11:49:11 2014
Return-path: <std-proposals+bncBCO3NDEYZQHRBJP66OLAKGQENYH56TY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pb0-f71.google.com ([209.85.160.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCO3NDEYZQHRBJP66OLAKGQENYH56TY@isocpp.org>)
	id 1W5CPm-0008Cv-Rb
	for gclcip-std-proposals@m.gmane.org; Mon, 20 Jan 2014 11:49:11 +0100
Original-Received: by mail-pb0-f71.google.com with SMTP id jt11sf12216857pbb.2
        for <gclcip-std-proposals@m.gmane.org>; Mon, 20 Jan 2014 02:49:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=N98eb37x2H7MVQ9flhbfReZIGHLYOEmOXgT4h0LfF2c=;
        b=YPZJnf8DXz85zGaDAe8MeLUL5Vrvt+tYADnc4Tzp/UaAfjl4J8gmhJXabHv8GUVHTv
         74TXfu3Ng7m41pi3U6gBhf//eCCmjmMlh1GXkcBEWdyR5MRAy8i91Wt/L6gpnFkg1k8d
         iY/MQlYgL5vCr5O3BVZgqh5+qhfYjReJVYlZd6jY96Eq2UgAzcOQz9Kkr8ZP8W5rQBSN
         2C3b4wMLBnGOC8zelgb3XmateEIpIXHa4QK33KNgcC52gObE61kq1EFVYaIW1YEc/Gmy
         SZlhRl9VMEW9LAS/YXcbGA9jD2dsLkhK5j599HCu93c+/b23vYByZOzbjBtU/NzvlNlx
         H4rg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=N98eb37x2H7MVQ9flhbfReZIGHLYOEmOXgT4h0LfF2c=;
        b=WOOpoKcaMmw91fEBIE5lRHFWWIIUrTc6aqfaWDt33fulQgJ9DsrTxIZBXAdWT+ULHO
         j9FQS+kHsAHn4yio6+4j0pylszJs/qWbyM5xbF83rCkWEtlDuiG5A7uw7wNtgfM8W6Wb
         mbc9DOXZztlbeCn1QIWTlBHz2fYs8PP+tym0E7gYiBaRrELMDV8hghPm+eYP0E6zfFsq
         T9P6wRTNvMiRZhso/iR1fWfn/ZcNRUZ5t59UVATufHRewI1++7+Y1EMkU5cTE5myGB86
         iT2FDoZyWTQGh4cQD379Jd16GaosPx3l2yd8fBuDUsy7SoGSiPLlVsbC+lcEQQ19Ibrv
         kN3A==
X-Gm-Message-State: ALoCoQkNkVbJE8CTUfmOOEhccB2NEgHo7b2my+P3uHOcJ1WRKPbtyjgOgWXmiKmYCDlfxN51IfEb
X-Received: by 10.66.163.67 with SMTP id yg3mr499799pab.45.1390214949633;
        Mon, 20 Jan 2014 02:49:09 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.50.171 with SMTP id s40ls985370qga.17.gmail; Mon, 20 Jan
 2014 02:49:08 -0800 (PST)
X-Received: by 10.140.105.54 with SMTP id b51mr2883qgf.29.1390214948926;
        Mon, 20 Jan 2014 02:49:08 -0800 (PST)
In-Reply-To: <52DCE5B4.8090704@eudoxos.de>
X-Original-Sender: vittorio.romeo.vee@gmail.com
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:8734
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8734>

------=_Part_78_6611027.1390214948436
Content-Type: text/plain; charset=UTF-8

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/.

------=_Part_78_6611027.1390214948436
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">This is not what I expect, since it also prints the parent=
hesis.&nbsp;<br>The solution would be having a "variadic stringify function=
"<div><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 2=
50); border: 1px solid rgb(187, 187, 187); word-wrap: break-word;"><code cl=
ass=3D"prettyprint"><div class=3D"subprettyprint"><pre><span style=3D" colo=
r:#ef2672;"><span style=3D"color: #800;" class=3D"styled-by-prettify">#defi=
ne</span></span><span style=3D" color:#3e3d32;"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span></span><span style=3D" color:#ef2672=
;"><span style=3D"color: #000;" class=3D"styled-by-prettify">SSVPP_IMPL_STR=
INGIFYWITHCOMMAS</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">mIdx</span><span style=3D" c=
olor:#e6e5e2;"><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span></span><span style=3D" color:#3e3d32;"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">mData</span><span style=3D" color:#e6e5e2;"><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">,</span></span><span s=
tyle=3D" color:#3e3d32;"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span></span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">mArg</span><span style=3D" color:#e6e5e2;"><span style=3D"color: #660=
;" class=3D"styled-by-prettify">)</span></span><span style=3D" color:#3e3d3=
2;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp; </spa=
n></span><span style=3D" color:#ef2672;"><span 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</spa=
n><span style=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">)</span></span><span style=3D" color:#ef2672;"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">SSVPP_IF</span></span><span =
style=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span></span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">mIdx</span><span style=3D" color:#e6e5e2;"><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span></span><span style=3D" color:#3e3d=
32;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></sp=
an><span style=3D" color:#e6db74;"><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">",</span></span><span style=3D" color:#3e3d32;"><span sty=
le=3D"color: #080;" class=3D"styled-by-prettify"> </span></span><span style=
=3D" color:#e6db74;"><span style=3D"color: #080;" class=3D"styled-by-pretti=
fy">"</span></span><span style=3D" color:#e6e5e2;"><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span></span><span style=3D" color:#3e3=
d32;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></s=
pan><span style=3D" color:#ef2672;"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">SSVPP_EMPTY</span></span><span style=3D" color:#e6e5e2;"=
><span style=3D"color: #660;" class=3D"styled-by-prettify">())</span></span=
></pre><pre><span style=3D" color:#ef2672;"><span style=3D"color: #800;" cl=
ass=3D"styled-by-prettify">#define</span></span><span style=3D" color:#3e3d=
32;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></sp=
an><span style=3D" color:#ef2672;"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">SSVPP_STRINGIFYWITHCOMMAS</span></span><span style=3D" co=
lor:#e6e5e2;"><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"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></span><span style=3D" color:#ef267=
2;"><span style=3D"color: #000;" class=3D"styled-by-prettify">SSVPP_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;" cl=
ass=3D"styled-by-prettify">SSVPP_IMPL_STRINGIFYWITHCOMMAS</span><span style=
=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">,</span></span><span style=3D" color:#3e3d32;"><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span></span><span style=3D" color:#ef2=
672;"><span style=3D"color: #000;" class=3D"styled-by-prettify">SSVPP_EMPTY=
</span></span><span style=3D" color:#e6e5e2;"><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__</spa=
n><span style=3D" color:#e6e5e2;"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">)</span></span></pre></div></code></div><br>However, it ne=
eds 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:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;">On 2014-01-20 09:53, Vittorio Romeo=
 wrote:
<br>&gt; <a href=3D"http://ideone.com/B5hVDS" target=3D"_blank" onmousedown=
=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fideone.com%2FB5=
hVDS\46sa\75D\46sntz\0751\46usg\75AFQjCNFN00duigtqjYQCPYDVTUIs2QmR1w';retur=
n true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2=
Fideone.com%2FB5hVDS\46sa\75D\46sntz\0751\46usg\75AFQjCNFN00duigtqjYQCPYDVT=
UIs2QmR1w';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 d=
oes
<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 href=3D"http://ideone.com/DXXOXP" target=3D"_blank" onmousedown=3D"t=
his.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fideone.com%2FDXXOXP\=
46sa\75D\46sntz\0751\46usg\75AFQjCNE0QEFIl6Yaqmdo5g6xSgGW64vK2Q';return tru=
e;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fideo=
ne.com%2FDXXOXP\46sa\75D\46sntz\0751\46usg\75AFQjCNE0QEFIl6Yaqmdo5g6xSgGW64=
vK2Q';return true;">http://ideone.com/DXXOXP</a> (works as expected)
<br></blockquote></div></div>

<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 />

------=_Part_78_6611027.1390214948436--

.
