220 40328 <e20ce6f4-d93e-4bdd-a17f-c36d63c48d55@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: florian.csdt@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Runtime code generation and self modifying code
Date: Fri, 5 Oct 2018 01:40:20 -0700 (PDT)
Lines: 139
Approved: news@gmane.org
Message-ID: <e20ce6f4-d93e-4bdd-a17f-c36d63c48d55@isocpp.org>
References: <4489f889-977c-45f2-8a2f-186ee3b06bff@isocpp.org>
 <CAJEeERU+5x5VuPFBTKizOzK-U2AeUZEc9W9-sD508+sPSfK4fg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_630_828919830.1538728820261"
X-Trace: blaine.gmane.org 1538728698 24782 195.159.176.226 (5 Oct 2018 08:38:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 5 Oct 2018 08:38:18 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC26HM4V3MIRB5OG3TOQKGQEQETUTQI@isocpp.org Fri Oct 05 10:38:14 2018
Return-path: <std-proposals+bncBC26HM4V3MIRB5OG3TOQKGQEQETUTQI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw1-f70.google.com ([209.85.161.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC26HM4V3MIRB5OG3TOQKGQEQETUTQI@isocpp.org>)
	id 1g8Lch-0006JY-C9
	for gclcip-std-proposals@m.gmane.org; Fri, 05 Oct 2018 10:38:11 +0200
Original-Received: by mail-yw1-f70.google.com with SMTP id v144-v6sf6905361ywa.23
        for <gclcip-std-proposals@m.gmane.org>; Fri, 05 Oct 2018 01:40:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        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;
        bh=n3GyzuTjU1oJ/2j/I2HPB+p0zOXiXNk4HT/9Gr60I44=;
        b=mSRNvY0IQz/LWtqpT368A5SK4KmchJVWmNBnIIa8LlCykcXr2AxGXu/tMJkgev+Lzk
         OfUnP/yFmaCrZxmrRqRGCFG/YSDK7BZzpOn96zS2b7sdpHtP6Klb+aQLs9arUg8MU9id
         s3wP+vBovSgKUogFlVub5y1KucwqdpuNwBKgVHy29rxlYYhz9lTA47fwPwS57vhMQ/HT
         9hEpb2SYWDYAGPtgVs39SbDUqtwbjlqT9ZLKzf7GCjPjPlCxHCzLwdRccggpaRn4Qzk4
         V/DkzxPMHyjZs2CEruhevWmHtzrRV84nlZw9jeX8H8Su5vH1po3t8aEjpmbdqcJubPbI
         rpgQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        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;
        bh=n3GyzuTjU1oJ/2j/I2HPB+p0zOXiXNk4HT/9Gr60I44=;
        b=D+enFqeHMyU/gO/7E0cqfUlwC1juu7f2hAwWETVOYDf4o3RTDZ5ADhC0MYk81uPxXr
         G5yhqqiB+Es9CIaQFpJixtLqUmT735vBGliRySw2+Vipgx5Us5uopPdk03Q+PZoOCH1r
         f8XYUa4+KCBOq1pVV5dluwGUGlyu1UN5Sc5H6ID3KEcNx7M/deOU8jxC95kBQFtZrgzz
         P4YcMrLA2nszOUqhgo/WQG6n2pDmkq7gtzAYh7cZmkLK7cceevDvV8rbj2hv9ElGamKQ
         MFWVB6fzKVkiHeRKdtk89MzJDDt8kEPaSBdQuvUjs0ltC1M2w3y5gy1yZpp3fYxXBsUE
         Qa1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        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:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=n3GyzuTjU1oJ/2j/I2HPB+p0zOXiXNk4HT/9Gr60I44=;
        b=QSD9KD6VzUrkxB8YhrXu7yM45rHBVNYlQ6xx1NB3FLv8EmsGeZ3yBHTsVc23S/eulq
         SceabXxVTclX0yoSq81I6L/DxgG84wOy4pJfOCOplD3LcK0V1pP1gVtGxf+OOHnIGuBx
         olnuTWAKNuIiUgX2nOg2sGF04qm7cCcnF9iex1dYn50zl4zG1P0g8zGV7rZhV6t0NWgr
         XGQMLv2DPCgq23jTQ0LQwZuuTe46wCy+495uFHLwfDT4K++H2ZDcqBFJygOVrWl4UTHD
         0oQ/gqC2BIE6Qd34kUTUlpL8k5/CHte9355gii8j6dMptiPE6PI5erAbw8RERR219ZqH
         WQuw==
X-Gm-Message-State: ABuFfoj18Xxn32bLu1NpMemlVpDE8QccoVYrdaDFAIZe5mYi0yQdAsri
	3+X8s6AudFg/eV5KkTjyLOdTog==
X-Google-Smtp-Source: ACcGV62Pmv13I4oapcdcomCtmxxWiwA6iMLd8CIag3/OUHWp3loHubVcuUilCrwfl8XZH8wptzqz8Q==
X-Received: by 2002:a25:824f:: with SMTP id d15-v6mr5964383ybn.87.1538728821879;
        Fri, 05 Oct 2018 01:40:21 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a0d:c402:: with SMTP id g2-v6ls2485609ywd.8.gmail; Fri, 05
 Oct 2018 01:40:21 -0700 (PDT)
X-Received: by 2002:a81:1a07:: with SMTP id a7-v6mr108914ywa.1.1538728820806;
        Fri, 05 Oct 2018 01:40:20 -0700 (PDT)
In-Reply-To: <CAJEeERU+5x5VuPFBTKizOzK-U2AeUZEc9W9-sD508+sPSfK4fg@mail.gmail.com>
X-Original-Sender: florian.csdt@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:40328
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40328>

------=_Part_630_828919830.1538728820261
Content-Type: multipart/alternative; 
	boundary="----=_Part_631_1054089242.1538728820262"

------=_Part_631_1054089242.1538728820262
Content-Type: text/plain; charset="UTF-8"

Also, such a "modifying" code is already implementable now, and is already 
used for shared object linking: jumping to a mutable pointer.

int* p = nullptr;
int* init_p();
int*(*get_p)() = &init_p;

int* noinit_p() {
  return p;
}
int* init_p() {
  // needs atomic here
  if (!p) {
    p = new int();
  }

  // needs atomic also here
  get_p = &noinit_p;

  return p;
}


-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e20ce6f4-d93e-4bdd-a17f-c36d63c48d55%40isocpp.org.

------=_Part_631_1054089242.1538728820262
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Also, such a &quot;modifying&quot; code is already im=
plementable now, and is already used for shared object linking: jumping to =
a mutable pointer.</div><div><br></div><div><div style=3D"background-color:=
 rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid;=
 border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> p </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">nul=
lptr</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> init_p</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">();</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">*(*</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">get_p</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">)()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">init_p</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">int</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> noinit_p</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> p</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">int</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> init_p</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">// needs atomic here</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">if</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(!</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">p</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 p </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">new</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br><br>=C2=A0 </span><span style=3D"color:=
 #800;" class=3D"styled-by-prettify">// needs atomic also here</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 get_p </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">noinit_p</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br><br>=C2=A0 </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> p</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span></div></code></div><br><br> </div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e20ce6f4-d93e-4bdd-a17f-c36d63c48d55%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e20ce6f4-d93e-4bdd-a17f-c36d63c48d55=
%40isocpp.org</a>.<br />

------=_Part_631_1054089242.1538728820262--

------=_Part_630_828919830.1538728820261--

.
