220 37531 <1e25a8ae-4752-4fc0-8c89-639cef53121c@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Edward Catmur <ed@catmur.co.uk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Allowing std::complex's magic permission for
 other types
Date: Wed, 28 Mar 2018 07:42:54 -0700 (PDT)
Lines: 97
Approved: news@gmane.org
Message-ID: <1e25a8ae-4752-4fc0-8c89-639cef53121c@isocpp.org>
References: <a3462649-a7bd-4215-b162-e8fe922df02d@isocpp.org>
 <p9c1k7$h28$1@blaine.gmane.org> <e85dfb30-f3ff-4769-90d2-373efceda1e6@isocpp.org>
 <CAA7YVg2n1N_QrxC09Er4vLr+ebwQ5GhkD-3isND76d4YJHwC0g@mail.gmail.com> <018c02d9-7c65-4451-acc1-c49196fc7622@isocpp.org>
 <CAA7YVg1Tt-hwYej80qK_Cr2RxvBtP3aM+EZ7gqC4RKz6z9aGPw@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_22308_2114014568.1522248174798"
X-Trace: blaine.gmane.org 1522248056 21439 195.159.176.226 (28 Mar 2018 14:40:56 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 28 Mar 2018 14:40:56 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDZLZTXF7UJBB36T53KQKGQE7PKUPMI@isocpp.org Wed Mar 28 16:40:52 2018
Return-path: <std-proposals+bncBDZLZTXF7UJBB36T53KQKGQE7PKUPMI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f72.google.com ([209.85.213.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDZLZTXF7UJBB36T53KQKGQE7PKUPMI@isocpp.org>)
	id 1f1CFt-0005OS-Dp
	for gclcip-std-proposals@m.gmane.org; Wed, 28 Mar 2018 16:40:49 +0200
Original-Received: by mail-vk0-f72.google.com with SMTP id d67sf1743218vka.12
        for <gclcip-std-proposals@m.gmane.org>; Wed, 28 Mar 2018 07:42:57 -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=lZnDImU9QH8ZDzpH2JP1V40zIL3iDwoy7QsoqT6JQNQ=;
        b=DX3kFIBKNtuE9m6UvKLmH8S2FgrKIfTgJt+2GYPNAyIanYynX5qln7zIkknepNnQp+
         XMzS4yp74HfGIu6niOPhzTtYXreHG8ypUWf5GuS+kTlziK5TV4lhElWU7TUDFDo2iUKI
         d+MGz+/RsmPjV9CNSsT0eDcHW6YsHGo401ZKrdJ1/RJAhNPdGamoWiVpKQFkbA21/Ilc
         9ks23LnouMR/XiXJs2s7f+PsBZWvdjRGQ/jAsiAYKUrjlgtdkNtdAZSmczksdXdSXIX5
         kVa5YIBSD8eSw5diRPikAta5HANolkDDT6wmtNkJeXl+P6gdtKZ8YfTI5Rtl4bJa7dG2
         L1gQ==
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=lZnDImU9QH8ZDzpH2JP1V40zIL3iDwoy7QsoqT6JQNQ=;
        b=crQyl4ri2D+6D0TOnJ12D4wgoxN9Bqlbp9bkOvUsfz1TRjtHJNRVe3nZrWGSJNez19
         m9K+t9BOycYEN4yC9Pl2qaVRbzEG+k5t0soxCmF7l3S4wj+8mud8/zwco+lTdgOE7jG0
         8Uj56xYX3Svd5oBfxYlpkKm5bwf9k0QY9AmvTTTpYKlYgOybfQ0oTOe+MIXew7Y/etD5
         guKBeNE7ICXqI4e/Bea4WX2wjeET0d75T2A0ggM0a9PH2faOzWos88v1aJT1B76mzunp
         EUjlOteCiMHREGlPBH0+9dtEwTRzSCyECPuaQVk/3G5YtyZC3+40drJmDRz9P3GD4MdD
         E4iw==
X-Gm-Message-State: AElRT7HljRyOwLREp9A75Fuh+1Ba1oSzFNboGLBKuDO4rU75SFIuE93s
	q8GLy+qHkbT+tbLOlcwxnKd0nA==
X-Google-Smtp-Source: AIpwx4+JSYNMG80ghiXvkODNizgvC1ZpXcaQKK0oT/sZLPOMwiUuf2Va7AcEbS13ZLC0eMKEusXkFw==
X-Received: by 10.31.216.69 with SMTP id p66mr2672632vkg.68.1522248176799;
        Wed, 28 Mar 2018 07:42:56 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.157.199 with SMTP id g190ls2434218vke.10.gmail; Wed, 28 Mar
 2018 07:42:55 -0700 (PDT)
X-Received: by 10.31.193.140 with SMTP id r134mr5982054vkf.6.1522248175222;
        Wed, 28 Mar 2018 07:42:55 -0700 (PDT)
In-Reply-To: <CAA7YVg1Tt-hwYej80qK_Cr2RxvBtP3aM+EZ7gqC4RKz6z9aGPw@mail.gmail.com>
X-Original-Sender: ed@catmur.co.uk
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:37531
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37531>

------=_Part_22308_2114014568.1522248174798
Content-Type: multipart/alternative; 
	boundary="----=_Part_22309_1419773551.1522248174798"

------=_Part_22309_1419773551.1522248174798
Content-Type: text/plain; charset="UTF-8"



On Wednesday, 28 March 2018 15:19:49 UTC+1, Viacheslav Usov wrote:
>
> On Wed, Mar 28, 2018 at 3:24 PM, Edward Catmur <e...@catmur.co.uk 
> <javascript:>> wrote:
>
> > No, you need magic to perform aliasing between any kind of array types. 
> [expr.add]/4 does not permit aliasing, so any array arithmetic must remain 
> within the bounds of an array that actually exists.
>
> Let's tackle a simpler question first. Suppose:
>
> int foo[5][2];
> auto bar = reinterpret_cast<int*>(&foo[0][0]);
>
> Are you saying that bar[2] is not well-defined?
>

bar[2] is well-defined, but it refers to the past-the-end element of 
foo[0], which cannot be accessed. It does not refer to foo[1][0], although 
it has the same address.

This is because there is only one array of type int[N] containing 
foo[0][0], and that is the array foo[0], which has only 2 elements.

bar[3] is not well-defined, and likewise the expression (bar + 3) has 
undefined behavior.

Cheers,
> V.
>

-- 
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/1e25a8ae-4752-4fc0-8c89-639cef53121c%40isocpp.org.

------=_Part_22309_1419773551.1522248174798
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, 28 March 2018 15:19:49 UTC+1, Viache=
slav Usov  wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div><div class=3D"gmail_quote">On Wed, Mar 28, 2018 at 3:24 PM, Edward=
 Catmur <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf=
-obfuscated-mailto=3D"lP-KTSyvAwAJ" rel=3D"nofollow" onmousedown=3D"this.hr=
ef=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javasc=
ript:&#39;;return true;">e...@catmur.co.uk</a>&gt;</span> wrote:<br><div><b=
r></div><div>&gt; No, you need magic to perform aliasing between any kind o=
f array types. [expr.add]/4 does not permit aliasing, so any array arithmet=
ic must remain within the bounds of an array that actually exists.</div><di=
v><br></div><div>Let&#39;s tackle a simpler question first. Suppose:</div><=
div><br></div><div>int foo[5][2];</div><div>auto bar =3D reinterpret_cast&l=
t;int*&gt;(&amp;foo[0]<wbr>[0]);</div><div><br></div><div>Are you saying th=
at bar[2] is not well-defined?</div></div></div></div></blockquote><div><br=
></div><div>bar[2] is well-defined, but it refers to the past-the-end eleme=
nt of foo[0], which cannot be accessed. It does not refer to foo[1][0], alt=
hough it has the same address.</div><div><br></div><div>This is because the=
re is only one array of type int[N] containing foo[0][0], and that is the a=
rray foo[0], which has only 2 elements.</div><div><br></div><div>bar[3] is =
not well-defined, and likewise the expression (bar + 3) has undefined behav=
ior.</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div =
dir=3D"ltr"><div><div class=3D"gmail_quote"><div></div><div>Cheers,</div><d=
iv>V.</div></div></div></div>
</blockquote></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/1e25a8ae-4752-4fc0-8c89-639cef53121c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1e25a8ae-4752-4fc0-8c89-639cef53121c=
%40isocpp.org</a>.<br />

------=_Part_22309_1419773551.1522248174798--

------=_Part_22308_2114014568.1522248174798--

.
