220 37521 <018c02d9-7c65-4451-acc1-c49196fc7622@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 06:24:19 -0700 (PDT)
Lines: 93
Approved: news@gmane.org
Message-ID: <018c02d9-7c65-4451-acc1-c49196fc7622@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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_22928_1271282971.1522243459364"
X-Trace: blaine.gmane.org 1522243338 16971 195.159.176.226 (28 Mar 2018 13:22:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 28 Mar 2018 13:22:18 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDZLZTXF7UJBBBFP53KQKGQEU3XZSWA@isocpp.org Wed Mar 28 15:22:14 2018
Return-path: <std-proposals+bncBDZLZTXF7UJBBBFP53KQKGQEU3XZSWA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDZLZTXF7UJBBBFP53KQKGQEU3XZSWA@isocpp.org>)
	id 1f1B1q-0004Ju-5F
	for gclcip-std-proposals@m.gmane.org; Wed, 28 Mar 2018 15:22:14 +0200
Original-Received: by mail-ua0-f197.google.com with SMTP id s19sf1582215uad.11
        for <gclcip-std-proposals@m.gmane.org>; Wed, 28 Mar 2018 06:24:21 -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=eoL9Tco7MNoFmf3MYtyUmiCZLltI2Lr1s7oDEm47JwM=;
        b=zWFEqNCjP2oNFUJ4R+T4ezFJKTOghKOa3TvSxigNASJs7U9ASx3Etdrnjx/anP8fo/
         x4ELAF+qB5wtyK249NGb8ySrbAMbj2aPFCuUb3jusPI0BEnFRrbyPHbE3z5f4PkuUHKt
         /3lJXB3TP0voNLG7pB5SzVLQmzgoZFg7kz7QnK7wICVCXZT0SqGZY1EDo0Bbh1pgnh5U
         i861pdUF1OqLdnTSlqJYUIkf726JrlFSjo9rBLphEpoAWvBr2jbaORNjqgxQ3AEfCiV7
         uWd80iHLOq2P/R11jOMDObJCRzRBHzHBkcTePNhPlbg97xjyHsv4iWhO/wfJAVp5BWYb
         lZgg==
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=eoL9Tco7MNoFmf3MYtyUmiCZLltI2Lr1s7oDEm47JwM=;
        b=tpVFH4gBz0LUfGKgmOcBR86sTcjfCaiOaLcMPCsBEFCw3WP5Xhwz7+v50mk4Fn20ex
         SEIvKMvIrOpS3wRmqOlDTpj9kQBqrOZi3M9NBqMznJ+2UAZ4dIgQROlqtucwNFKoZTX0
         Ly6h78TlwpuUykRmVbgeClo5TLOXHNrLtnI2M1hAfxZY2ZMuq8VrMyZTMaNChM5BwrIh
         s6G8szROf+O/SeSobb15zWYWzj2kOQoLkQrwsrLEfGxXiaTE7ZfnVoyTE09BccRJORRU
         DC4GRfgHbxvrsTxM0X5ovzqvojAQpvGNNwQNT0oeGmKGgTXNGOJ1cyX0iY0DzPueXa3J
         f6Og==
X-Gm-Message-State: AElRT7HSBbxX5BFnb7tfqQtUPXlX0zRUdrMGYyFXAbzJ91NH8kQBcFli
	Z51OISZh+7PQA7ThVfu9B13t9w==
X-Google-Smtp-Source: AG47ELtqJFI/CMKvgndKIvVUVjl/xFgBorDWO1QgKS2DKshpFRlAN59tXGcUcU9STwZyeBFQSGahsg==
X-Received: by 10.176.27.79 with SMTP id n15mr13213915uai.8.1522243461207;
        Wed, 28 Mar 2018 06:24:21 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.208.1 with SMTP id h1ls2195930vkg.19.gmail; Wed, 28 Mar
 2018 06:24:20 -0700 (PDT)
X-Received: by 10.31.157.18 with SMTP id g18mr5944119vke.2.1522243459790;
        Wed, 28 Mar 2018 06:24:19 -0700 (PDT)
In-Reply-To: <CAA7YVg2n1N_QrxC09Er4vLr+ebwQ5GhkD-3isND76d4YJHwC0g@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:37521
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37521>

------=_Part_22928_1271282971.1522243459364
Content-Type: multipart/alternative; 
	boundary="----=_Part_22929_983829046.1522243459364"

------=_Part_22929_983829046.1522243459364
Content-Type: text/plain; charset="UTF-8"



On Wednesday, 28 March 2018 11:35:02 UTC+1, Viacheslav Usov wrote:
>
> On Wed, Mar 28, 2018 at 1:17 AM, Myriachan <myri...@gmail.com 
> <javascript:>> wrote:
>
> > The C++ Standard rules state that you can treat an array of 
> std::complex<float> as an array of float of double the number of elements.  
> That is, you can do pointer arithmetic on a float * that crosses 
> complex<float> objects.  That cannot be done other than with compiler magic.
>
> Only "if a is an expression of type cv complex<T>* and the expression a[i] 
> is well-defined for an integer expression i", which has to mean that we 
> have an array of complex objects. Given that each is required to be layout 
> compatible with T[2], reinterpreting the bigger array as T[2 * (i + 1)] 
> does not need any more magic.
>

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.
 

> 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/018c02d9-7c65-4451-acc1-c49196fc7622%40isocpp.org.

------=_Part_22929_983829046.1522243459364
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, 28 March 2018 11:35:02 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 1:17 AM, Myriac=
han <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obf=
uscated-mailto=3D"44DtIOiiAwAJ" rel=3D"nofollow" onmousedown=3D"this.href=
=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascri=
pt:&#39;;return true;">myri...@gmail.com</a>&gt;</span> wrote:<br><div><br>=
</div><div>&gt; The C++ Standard rules state that you can treat an array of=
 std::complex&lt;float&gt; as an array of float of double the number of ele=
ments.=C2=A0 That is, you can do pointer arithmetic on a float * that cross=
es complex&lt;float&gt; objects.=C2=A0 That cannot be done other than with =
compiler magic.</div><div><br></div><div>Only &quot;if a is an expression o=
f type cv complex&lt;T&gt;* and the expression a[i] is well-defined for an =
integer expression i&quot;, which has to mean that we have an array of comp=
lex objects. Given that each is required to be layout compatible with T[2],=
 reinterpreting the bigger array as T[2 * (i + 1)] does not need any more m=
agic.</div></div></div></div></blockquote><div><br></div><div>No, you need =
magic to perform aliasing between any kind of array types. [expr.add]/4 doe=
s not permit aliasing, so any array arithmetic must remain within the bound=
s of an array that actually exists.</div><div>=C2=A0<br></div><blockquote c=
lass=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_q=
uote"><div></div><div>Cheers,</div><div>V.</div><div><br></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/018c02d9-7c65-4451-acc1-c49196fc7622%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/018c02d9-7c65-4451-acc1-c49196fc7622=
%40isocpp.org</a>.<br />

------=_Part_22929_983829046.1522243459364--

------=_Part_22928_1271282971.1522243459364--

.
