220 8703 <47db64d6-64fb-4243-bded-e36fc8be30b2@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Andrew Tomazos <andrewtomazos@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: "Raw" preprocessor macro arguments
Date: Sun, 19 Jan 2014 13:11:35 -0800 (PST)
Lines: 362
Approved: news@gmane.org
Message-ID: <47db64d6-64fb-4243-bded-e36fc8be30b2@isocpp.org>
References: <c0398870-b265-4d02-a814-ad84a472520c@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_411_15966508.1390165895400"
X-Trace: ger.gmane.org 1390165890 1110 80.91.229.3 (19 Jan 2014 21:11:30 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 19 Jan 2014 21:11:30 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD5KHQXXWYPRBB776CLAKGQEGZT3LAY@isocpp.org Sun Jan 19 22:11:38 2014
Return-path: <std-proposals+bncBD5KHQXXWYPRBB776CLAKGQEGZT3LAY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ig0-f197.google.com ([209.85.213.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD5KHQXXWYPRBB776CLAKGQEGZT3LAY@isocpp.org>)
	id 1W4zeb-0003Fw-B1
	for gclcip-std-proposals@m.gmane.org; Sun, 19 Jan 2014 22:11:37 +0100
Original-Received: by mail-ig0-f197.google.com with SMTP id j1sf11183383iga.0
        for <gclcip-std-proposals@m.gmane.org>; Sun, 19 Jan 2014 13:11:36 -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=ifL/0WCq9BPkBwWqAaZdaQIL0TyWsO6pCWnNfshAe6c=;
        b=mMlS5ffF1QsdzEezvyCmog5lMQu2Y2xZ5AgTZ32F+OywWiNFDJA0Bma36Vxcz5l2PQ
         Oy7wjwva65wHR8Agu/FM15bZfKXCB9m1qj+RSfhhyE9wVot3zZmVd9Ddo5IPfqtsZBjs
         Zvcix9X8uPxzPAImi+FPInhF7Rozy7hIZhRP+E4zBHJp1oDWU/Lin91/L7z9lStoo7Gg
         ohA8p2ijQUyJ+kRr1xMSFLGNZWqDFznhEceWjKAcUAJS39rQiOmPiyAoyPDL+r2RRTb2
         K69bWe7Y+zhOMcjhkbdRQ353I5eGnw8SPHORuUGMG6LEAhPhtP7GIBFs/c0ZDDxzofPB
         yK3w==
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=ifL/0WCq9BPkBwWqAaZdaQIL0TyWsO6pCWnNfshAe6c=;
        b=DvbTL0P/iueyg1U7LCOPr+ZmDkR4RDOIcwQSHRWPyi6gSTd24MAIAoutG0Ng+YAnMm
         2r4P9ZyK4/KVaMf2QKSQdgfCzRg4FVJUQPKBgatHAs81rIZ/tGsEH+KWgbXVrtEods94
         Nf39iWOs6MwZNzyE6fO2OPfLP9I9W7kpeEXWdeTbu68TAdRijmaxoGvMqyvYXSi9Ls6Z
         C1lqqR2B9I0BzynSgzcbDwfMRJbhxVWBQQZ/i+38rPJxazb4l3Njmlt2bKX2FE4n9RqF
         dWf42x1PiblIroaMv64KoXAnwX5mOQWzInyY0JIbp53UhZyxHa2BxJRjRI/nO5pa9mfN
         tX0A==
X-Gm-Message-State: ALoCoQlhL/H+lIIcE5QGlMyDFCo/rhO4zWi0xidjb+EeULqhe6qK431cjqUqhGAh6bBnz+6xvf+u
X-Received: by 10.42.98.81 with SMTP id r17mr4470359icn.8.1390165896300;
        Sun, 19 Jan 2014 13:11:36 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.92.240 with SMTP id b103ls226618qge.57.gmail; Sun, 19 Jan
 2014 13:11:35 -0800 (PST)
X-Received: by 10.140.42.87 with SMTP id b81mr371qga.41.1390165895765;
        Sun, 19 Jan 2014 13:11:35 -0800 (PST)
In-Reply-To: <c0398870-b265-4d02-a814-ad84a472520c@isocpp.org>
X-Original-Sender: andrewtomazos@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:8703
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8703>

------=_Part_411_15966508.1390165895400
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

#define RAW(x) x

GENERATE_FUNC(RAW(std::pair<int, int>), getPair1), return std::make_pair(1,=
=20
1));

The arguments to a macro are identified before macro expansion takes place=
=20
on the arguments.  So the above will nest out the comma like you want.

The preprocessor respects parenthesis for nesting arguments.

From 16.2:

The sequence of preprocessing tokens bounded by the outside-most matching=
=20
parentheses forms the list of
arguments for the function-like macro. The individual arguments within the=
=20
list are separated by comma
preprocessing tokens, *but comma preprocessing tokens between matching=20
inner parentheses do not separate*
*arguments*.

*After the arguments for the invocation of a function-like macro have been=
=20
identi=EF=AC=81ed, argument substitution*
*takes place.* A parameter in the replacement list, unless preceded by a #=
=20
or ## preprocessing token or
followed by a ## preprocessing token (see below), is replaced by the=20
corresponding argument after all macros
contained therein have been expanded. Before being substituted, each=20
argument=E2=80=99s preprocessing tokens are
completely macro replaced as if they formed the rest of the preprocessing=
=20
=EF=AC=81le; no other preprocessing tokens
are available.

On Sunday, January 19, 2014 6:28:43 PM UTC+1, Vittorio Romeo wrote:
>
> *Preprocessor macros*, even if potentially *unsafe*, still have place in=
=20
> a lot of C/C++ programs. Using macros is the sometimes only way to avoid=
=20
> verbose code repetition, to simulate static reflection or to generate cod=
e=20
> that would be impossible to generate only using templates.
> An issue with macros is that passing arguments is sometimes really=20
> counter-intuitive and dangerous.=20
>
> Example:
> #define GENERATE_FUNC(mType, mName, mBody) mType mName(){ mBody }
>
>
> // Ok, generates valid code
> GENERATE_FUNC(void, printHi, printf("hi");)
>
>
> // Ok, generates valid code
> GENERATE_FUNC(void, printNumber, printf("%d", 5);)
>
>
> // The comma in "<int, int>" is read as an additional argument - macro=20
> expansion fails
> GENERATE_FUNC(std::pair<int, int>, getPair1, return std::make_pair(1, 1);=
)
>
>
> // The comma in "<int, int>" is read correctly, but the generated code is=
=20
> invalid, as=20
> // the round parenthesis persist in the return type (look below for the=
=20
> expansion)
> GENERATE_FUNC((std::pair<int, int>), getPair2, return std::make_pair(1, 1
> );)
> /*
>     (std::pair<int, int>) getPair2() { return std::make_pair(1, 1); }
> */
>
> There are possible solutions to this issue:
> 1. Create a typedef for `std::pair<int, int>` - this solution is specific=
=20
> to this case, and may not always be applicable. Additionally, it requires=
=20
> the coder to define a new typedef,
> 2. Create multiple macros (for example, GENERATE_FUNC_START and=20
> GENERATE_FUNC_END), and let the user write the code in-between - this=20
> solution is ugly and error prone. Also, it scales poorly, as k "body"=20
> arguments would require k+1 macro definitions.
>
> These solutions, however, can be defined *hacks. *The issue is that there=
=20
> is no way to pass a "raw" argument to the preprocessor.=20
>
> Here's what I propose:
> *Similarly to C++11 raw strings, have a new syntax that allows the user t=
o=20
> pass "raw arguments" to preprocessor macros.*
>
> Example:
> GENERATE_FUNC(__R(std::pair<int, int>), __R(getPairRaw), __R(return std::
> make_pair(1, 1))
>
> Specification:
> < __R > <prefix> <(> <...> <)> <suffix>=20
>
> Prefix/suffix example:
> GENERATE_FUNC(__R***(ReturnType(int*))***, __R(getIntPtr), __R(return &
> someInt;))
>
> Unit test before example:
> UNIT_TEST_START()
>      EXPECT(some predicate);
>      ...=20
> UNIT_TEST_END()
>
> Unit test after example:
> UNIT_TEST(__R(
>      EXPECT(some predicate);
>      ...=20
> ))
>
> This "raw syntax" would also fix the "comma problem", that forced users t=
o=20
> define a "COMMA" macro for years:
> __R(,)
>
> *What do you think?*
>

--=20

---=20
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 e=
mail 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-proposa=
ls/.

------=_Part_411_15966508.1390165895400
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">#define RAW(x) x<div><br></div><div><span style=3D"font-fa=
mily: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);=
">GENERATE_FUNC</span><span style=3D"font-family: monospace; background-col=
or: rgb(250, 250, 250); color: rgb(102, 102, 0);">(RAW(</span><span style=
=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: rg=
b(0, 0, 0);">std</span><span style=3D"font-family: monospace; background-co=
lor: rgb(250, 250, 250); color: rgb(102, 102, 0);">::</span><span style=3D"=
font-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0,=
 0, 0);">pair</span><span style=3D"font-family: monospace; background-color=
: rgb(250, 250, 250); color: rgb(102, 102, 0);">&lt;</span><span style=3D"f=
ont-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0, =
0, 136);">int</span><span style=3D"font-family: monospace; background-color=
: rgb(250, 250, 250); color: rgb(102, 102, 0);">,</span><span style=3D"font=
-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, =
0);">&nbsp;</span><span style=3D"font-family: monospace; background-color: =
rgb(250, 250, 250); color: rgb(0, 0, 136);">int</span><span style=3D"font-f=
amily: monospace; background-color: rgb(250, 250, 250); color: rgb(102, 102=
, 0);">&gt;),</span><span style=3D"font-family: monospace; background-color=
: rgb(250, 250, 250); color: rgb(0, 0, 0);">&nbsp;getPair1)</span><span sty=
le=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: =
rgb(102, 102, 0);">,</span><span style=3D"font-family: monospace; backgroun=
d-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">&nbsp;</span><span style=
=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: rg=
b(0, 0, 136);">return</span><span style=3D"font-family: monospace; backgrou=
nd-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">&nbsp;std</span><span s=
tyle=3D"font-family: monospace; background-color: rgb(250, 250, 250); color=
: rgb(102, 102, 0);">::</span><span style=3D"font-family: monospace; backgr=
ound-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">make_pair</span><span=
 style=3D"font-family: monospace; background-color: rgb(250, 250, 250); col=
or: rgb(102, 102, 0);">(</span><span style=3D"font-family: monospace; backg=
round-color: rgb(250, 250, 250); color: rgb(0, 102, 102);">1</span><span st=
yle=3D"font-family: monospace; background-color: rgb(250, 250, 250); color:=
 rgb(102, 102, 0);">,</span><span style=3D"font-family: monospace; backgrou=
nd-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">&nbsp;</span><span styl=
e=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: r=
gb(0, 102, 102);">1</span><span style=3D"font-family: monospace; background=
-color: rgb(250, 250, 250);"><font color=3D"#666600">));</font></span><br><=
/div><div><br></div><div>The arguments to a macro are identified before mac=
ro expansion takes place on the arguments. &nbsp;So the above will nest out=
 the comma like you want.</div><div><br></div><div>The preprocessor respect=
s parenthesis for nesting arguments.</div><div><br></div><div>From 16.2:</d=
iv><div><br><div>The sequence of preprocessing tokens bounded by the outsid=
e-most matching parentheses forms the list of</div><div>arguments for the f=
unction-like macro. The individual arguments within the list are separated =
by comma</div><div>preprocessing tokens, <b>but comma preprocessing tokens =
between matching inner parentheses do not separate</b></div><div><b>argumen=
ts</b>.</div><div><br></div><div><div><b>After the arguments for the invoca=
tion of a function-like macro have been identi=EF=AC=81ed, argument substit=
ution</b></div><div><b>takes place.</b> A parameter in the replacement list=
, unless preceded by a # or ## preprocessing token or</div><div>followed by=
 a ## preprocessing token (see below), is replaced by the corresponding arg=
ument after all macros</div><div>contained therein have been expanded. Befo=
re being substituted, each argument=E2=80=99s preprocessing tokens are</div=
><div>completely macro replaced as if they formed the rest of the preproces=
sing =EF=AC=81le; no other preprocessing tokens</div><div>are available.</d=
iv></div><div><br></div>On Sunday, January 19, 2014 6:28:43 PM UTC+1, Vitto=
rio Romeo wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r"><b>Preprocessor macros</b>,&nbsp;even if potentially&nbsp;<i>unsafe</i>,=
 still have place in a lot of C/C++ programs. Using macros is the sometimes=
 only way to avoid verbose code repetition, to simulate static reflection o=
r to generate code that would be impossible to generate only using template=
s.<div>An issue with macros is that passing arguments is sometimes really c=
ounter-intuitive and dangerous.&nbsp;<br><br>Example:</div><div><div style=
=3D"background-color:rgb(250,250,250);border:1px solid rgb(187,187,187);wor=
d-wrap:break-word"><code><div><span style=3D"color:#800">#define</span><spa=
n style=3D"color:#000"> GENERATE_FUNC</span><span style=3D"color:#660">(</s=
pan><span style=3D"color:#000">mType</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> mName</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> mBody</span><span style=3D"color:#660">)</sp=
an><span style=3D"color:#000"> mType mName</span><span style=3D"color:#660"=
>(){</span><span style=3D"color:#000"> mBody </span><span style=3D"color:#6=
60">}</span><span style=3D"color:#000"><br><br><br></span><span style=3D"co=
lor:#800">// Ok, generates valid code</span><span style=3D"color:#000"><br>=
GENERATE_FUNC</span><span style=3D"color:#660">(</span><span style=3D"color=
:#008">void</span><span style=3D"color:#660">,</span><span style=3D"color:#=
000"> printHi</span><span style=3D"color:#660">,</span><span style=3D"color=
:#000"> printf</span><span style=3D"color:#660">(</span><span style=3D"colo=
r:#080">"hi"</span><span style=3D"color:#660">);)</span><span style=3D"colo=
r:#000"><br><br><br></span><span style=3D"color:#800">// Ok, generates vali=
d code</span><span style=3D"color:#000"><br>GENERATE_FUNC</span><span style=
=3D"color:#660">(</span><span style=3D"color:#008">void</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> printNumber</span><span=
 style=3D"color:#660">,</span><span style=3D"color:#000"> printf</span><spa=
n style=3D"color:#660">(</span><span style=3D"color:#080">"%d"</span><span =
style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#066">5</span><span style=3D"color:#660">);)</span><span style=3D=
"color:#000"><br><br><br></span><span style=3D"color:#800">// The comma in =
"&lt;int, int&gt;" is read as an additional argument - macro expansion fail=
s</span><span style=3D"color:#000"><br>GENERATE_FUNC</span><span style=3D"c=
olor:#660">(</span><span style=3D"color:#000">std</span><span style=3D"colo=
r:#660">::</span><span style=3D"color:#000">pair</span><span style=3D"color=
:#660">&lt;</span><span style=3D"color:#008">int</span><span style=3D"color=
:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">int</span><span style=3D"color:#660">&gt;,</span><span style=3D"color:#00=
0"> getPair1</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> </span><span style=3D"color:#008">return</span><span style=3D"color:=
#000"> std</span><span style=3D"color:#660">::</span><span style=3D"color:#=
000">make_pair</span><span style=3D"color:#660">(</span><span style=3D"colo=
r:#066">1</span><span style=3D"color:#660">,</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#066">1</span><span style=3D"color:#660">);=
)</span><span style=3D"color:#000"><br><br><br></span><span style=3D"color:=
#800">// The comma in "&lt;int, int&gt;" is read correctly, but the generat=
ed code is invalid, as </span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#800">// the round parenthesis persist in the return type (lo=
ok below for the expansion)</span><span style=3D"color:#000"><br>GENERATE_F=
UNC</span><span style=3D"color:#660">((</span><span style=3D"color:#000">st=
d</span><span style=3D"color:#660">::</span><span style=3D"color:#000">pair=
</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">int=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">int</span><span style=3D"color:#660">&gt;),</s=
pan><span style=3D"color:#000"> getPair2</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">return=
</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">make_pair</span><span style=3D"color:#660"=
>(</span><span style=3D"color:#066">1</span><span style=3D"color:#660">,</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#066">1</span><=
span style=3D"color:#660">);)</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#800">/*<br>&nbsp; &nbsp; (std::pair&lt;int, int&gt;) g=
etPair2() { return std::make_pair(1, 1); }<br>*/</span></div></code></div><=
div><br></div></div><div>There are possible solutions to this issue:</div>1=
.. Create a typedef for `std::pair&lt;int, int&gt;` - this solution is speci=
fic to this case, and may not always be applicable. Additionally, it requir=
es the coder to define a new typedef,<div>2. Create multiple macros (for ex=
ample, GENERATE_FUNC_START and GENERATE_FUNC_END), and let the user write t=
he code in-between - this solution is ugly and error prone. Also, it scales=
 poorly, as k "body" arguments would require k+1 macro definitions.</div><d=
iv><br></div><div>These solutions, however, can be defined <i>hacks. </i>Th=
e issue is that there is no way to pass a "raw" argument to the preprocesso=
r.&nbsp;</div><div><br></div><div>Here's what I propose:</div><div><b>Simil=
arly to C++11 raw strings, have a new syntax that allows the user to pass "=
raw arguments" to preprocessor macros.</b></div><div><br></div><div>Example=
:</div><div><div style=3D"background-color:rgb(250,250,250);border:1px soli=
d rgb(187,187,187);word-wrap:break-word"><code><div><font color=3D"#000000"=
><span style=3D"color:#000">GENERATE_FUNC</span><span style=3D"color:#660">=
(</span><span style=3D"color:#000">__R</span><span style=3D"color:#660">(</=
span><span style=3D"color:#000">std</span><span style=3D"color:#660">::</sp=
an><span style=3D"color:#000">pair</span><span style=3D"color:#660">&lt;</s=
pan><span style=3D"color:#008">in<wbr>t</span><span style=3D"color:#660">,<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#008">int</sp=
an><span style=3D"color:#660">&gt;),</span><span style=3D"color:#000"> __R<=
/span><span style=3D"color:#660">(</span><span style=3D"color:#000">getPair=
Raw</span><span style=3D"color:#660">),</span><span style=3D"color:#000"> _=
_R</span><span style=3D"color:#660">(</span><span style=3D"color:#008">retu=
rn</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">:=
:</span><span style=3D"color:#000">make_pair</span><span style=3D"color:#66=
0">(</span><span style=3D"color:#066">1</span><span style=3D"color:#660">,<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#066">1</span=
><span style=3D"color:#660">))</span><span style=3D"color:#000"><br></span>=
</font></div></code></div><br>Specification:</div><div><div style=3D"backgr=
ound-color:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wrap:bre=
ak-word"><code><div><font color=3D"#660066"><span style=3D"color:#000">&lt;=
 __R &gt; </span><span style=3D"color:#008">&lt;prefix&gt;</span><span styl=
e=3D"color:#000"> &lt;(&gt; &lt;...&gt; &lt;)&gt; </span><span style=3D"col=
or:#008">&lt;suffix&gt;</span><span style=3D"color:#000"> </span></font></d=
iv></code></div><br>Prefix/suffix example:</div><div><div style=3D"backgrou=
nd-color:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wrap:break=
-word"><code><div><span style=3D"color:#000">GENERATE_FUNC</span><span styl=
e=3D"color:#660">(</span><span style=3D"color:#000">__R</span><span style=
=3D"color:#660">***(</span><span style=3D"color:#606">ReturnTyp<wbr>e</span=
><span style=3D"color:#660">(</span><span style=3D"color:#008">int</span><s=
pan style=3D"color:#660">*))***,</span><span style=3D"color:#000"> __R</spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#000">getIntPtr</=
span><span style=3D"color:#660">),</span><span style=3D"color:#000"> __R</s=
pan><span style=3D"color:#660">(</span><span style=3D"color:#008">return</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">&amp;</sp=
an><font color=3D"#006666"><span style=3D"color:#000">someInt</span><span s=
tyle=3D"color:#660">;))</span><span style=3D"color:#000"><br></span></font>=
</div></code></div><br></div><div>Unit test before example:</div><div><div =
style=3D"background-color:rgb(250,250,250);border:1px solid rgb(187,187,187=
);word-wrap:break-word"><code><div><font color=3D"#660066"><span style=3D"c=
olor:#000">UNIT_TEST_START</span><span style=3D"color:#660">()</span><span =
style=3D"color:#000"><br></span></font><span style=3D"color:#000">&nbsp; &n=
bsp; &nbsp;EXPECT</span><span style=3D"color:#660">(</span><span style=3D"c=
olor:#000">some predicate</span><span style=3D"color:#660">);</span><span s=
tyle=3D"color:#000"><br>&nbsp; &nbsp; &nbsp;</span><span style=3D"color:#66=
0">...</span><span style=3D"color:#000"> <br></span><font color=3D"#660066"=
><span style=3D"color:#000">UNIT_TEST_END</span><span style=3D"color:#660">=
()</span></font></div></code></div><br></div><div>Unit test after example:<=
/div><div><div style=3D"background-color:rgb(250,250,250);border:1px solid =
rgb(187,187,187);word-wrap:break-word"><code><div><font color=3D"#660066"><=
span style=3D"color:#000">UNIT_TEST</span><span style=3D"color:#660">(</spa=
n><span style=3D"color:#000">__R</span><span style=3D"color:#660">(</span><=
span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp;EXPECT</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">some predicate</span><sp=
an style=3D"color:#660">);</span><span style=3D"color:#000"><br>&nbsp; &nbs=
p; &nbsp;</span><span style=3D"color:#660">...</span><span style=3D"color:#=
000"> <br></span><span style=3D"color:#660">))</span></font></div></code></=
div><br>This "raw syntax" would also fix the "comma problem", that forced u=
sers to define a "COMMA" macro for years:</div><div><div style=3D"backgroun=
d-color:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wrap:break-=
word"><code><div><font color=3D"#660066"><span style=3D"color:#000">__R</sp=
an><span style=3D"color:#660">(,)</span></font></div></code></div><br><b>Wh=
at do you think?</b></div></div></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_411_15966508.1390165895400--

.
