220 37486 <p9c1k7$h28$1@blaine.gmane.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Bo Persson <bop@gmb.dk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allowing std::complex's magic permission for
 other types
Date: Tue, 27 Mar 2018 02:03:20 +0200
Lines: 31
Approved: news@gmane.org
Message-ID: <p9c1k7$h28$1@blaine.gmane.org>
References: <a3462649-a7bd-4215-b162-e8fe922df02d@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
X-Trace: blaine.gmane.org 1522108885 18478 195.159.176.226 (27 Mar 2018 00:01:25 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 27 Mar 2018 00:01:25 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.7.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCZ6RLW3UIKBBUEU43KQKGQE543XJDA@isocpp.org Tue Mar 27 02:01:21 2018
Return-path: <std-proposals+bncBCZ6RLW3UIKBBUEU43KQKGQE543XJDA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f69.google.com ([209.85.215.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCZ6RLW3UIKBBUEU43KQKGQE543XJDA@isocpp.org>)
	id 1f0c3F-0004ib-J6
	for gclcip-std-proposals@m.gmane.org; Tue, 27 Mar 2018 02:01:21 +0200
Original-Received: by mail-lf0-f69.google.com with SMTP id h16-v6sf1177841lfg.13
        for <gclcip-std-proposals@m.gmane.org>; Mon, 26 Mar 2018 17:03:29 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1522109009; cv=pass;
        d=google.com; s=arc-20160816;
        b=MLDmUCyQcV8OL+rvaKkUnDyAX3lIYujY7o7Lkpxv7Q1aqxZWqM/OFHW6VwquzXQA6E
         pLZrQXgE7hPMtl77LgxAJukQxLZW4nbBg+CjSiJD7EsxWKf6T8MfxtAGRLguk9mBRvHH
         5Q8JzULQ71sNlylUnNe0Gj/xn6j6izLXAl+nfRf1fQwrSykyP9Cf0WM+FU5HlsGM6VJK
         n4RxhR8ptRl2oFRKrG+kta7HldDXUlMXDrcJ0jfRjyFvZGfU6g3R7hB6uqL6hB19uKEB
         jQ64gAwLz8GJLS/l394wylfM8ga94hnPthqhBlOZrJRFfeCEuAkfeD18RHyAdy5qziXj
         estQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :in-reply-to:user-agent:mime-version:references:message-id:lines
         :date:subject:from:to:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=5HWe6jxMAyOJ+ZriPqPZDYUQUtyApeXBntKvxQ1yQs8=;
        b=Eazk4yYKgQho1jNtZzhWUFQAPBCYgz+3cbASeZmuNMCFaRPp8QTlwB/NMSnkLzI7pH
         UPYw88HUAiJSUAzlK/0klU5B7vjybVROHDuqs8bDvc34dWI3cOKChm2e5M/puuibeqGC
         ndka1Txir4vzPW+GQdI6T5DpduU/FwF0fF58iDudTK/eB50JvNwXNjBeKdH0s7I/3gIJ
         Gf0T3quaE8vnhfSRKk2E4SeT2oRea17eoaVzqvpV+qlvzv32nljez9qBnQGvo3MAd52e
         KvefWZ5UUtgVLIDdjtiMPUq2+DTs2nMckesbp4UBPc59bX+gIMq5q/CforxZtzCs/Quo
         BYHQ 
ARC-Authentication-Results: i=2; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:date:lines:message-id:references:mime-version
         :user-agent:in-reply-to:content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=5HWe6jxMAyOJ+ZriPqPZDYUQUtyApeXBntKvxQ1yQs8=;
        b=K9WPylD9OStxfCHEX3YJ96LIJdoTrW8oH6kKagr50puE5SWqsm+YMAxx2eAW+e+qNl
         QNklwb7G8pZb/o02y9D/1whMy/XaLcywie11OiAFyWcpngLeWBLcb6X11qL45vcnNgJu
         chLmg4SNX24MCgEoRqJM/IjQz5qjkctpjqmkLFM41rkg7EhTs5QknQHgMsy7/SG3/1et
         azXIBXcZwJNgSxh2GlZGOP2Lo7IbnOqxnxF/hzifm0VoPXXofWHaqCFUs/h3DqeIkL5R
         jno42VRCZ/d1Bu2k073HOxilyB5NNijGJLCA8PI4ziGCEIDDEmNioBH8eG+lIdnRHEUF
         h38w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent:in-reply-to:content-language
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=5HWe6jxMAyOJ+ZriPqPZDYUQUtyApeXBntKvxQ1yQs8=;
        b=eOguPYyjSy1e5RtevjMkzlqnIiaaCl9elyaUPGmdGdplcEi4X9gMtGTUbF28IDiZ+J
         QtArDD6Hoh/rfDQgv/+v2ZR5yyLRnh9X6T9B7pWrOdyRBakGlzpLWd0/ALrzZZ/NXU3i
         /Wvv3TClxiYY53DJu78/1bdQYIig6ePJNsraUEvwtDkX1nhJeY8QEAHhA9PS60vzMFFI
         Bl72YCmrDYTO3uaexmLbWU4Bicz95pL8klrbdsmgJ8yBAg2z+ecYZNPGPb26xuT4+qN7
         KIVZ15y1BCdCFsuVe7tqbcNUcybELYvlmfjDI9i1SuJz/wZWLqymomHtHdmBF3e4gvsh
     
X-Gm-Message-State: AElRT7GJkQQEGzF9JhDWeQtqqOouS+CRwAlGV+swSx3sALCrvjqgK63K
	xc7RMxj98si6kkZPM6cxQNo=
X-Google-Smtp-Source: AIpwx48lc3iq4fLypp9jzXmTr6RaK7G88skukuCXcTC/js5/r1Va7FeXuktuK42InWOYX3WopsDrWQ==
X-Received: by 2002:a19:29cd:: with SMTP id p196-v6mr291864lfp.13.1522109009238;
        Mon, 26 Mar 2018 17:03:29 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a19:fc0c:: with SMTP id a12-v6ls945279lfi.13.gmail; Mon, 26
 Mar 2018 17:03:27 -0700 (PDT)
X-Received: by 2002:a19:ccd7:: with SMTP id c206-v6mr24446769lfg.53.1522109007888;
        Mon, 26 Mar 2018 17:03:27 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1522109007; cv=none;
        d=google.com; s=arc-20160816;
        b=vJMXFhgxHAuMCXQLtIBF7JeDx+ZrSwpzl41lWM8JMs9eoJJzF1roU46/S2tr9+urJZ
         wJXeLt/m+i/7Cp6Xg6K2nleba64vW4hXt2dva7dftwTtfvqnP8QqFZ2zdUuNhYy8wRxE
         +uhp3dcFT9WW0TYlEtz2mVHDc/bvGK+/ZZ8z5LzIcc5H5pYc7iGL9zfp6Ud6uZ3VuEbE
         r2Gk0B8/GhfhO14Qb4le37wZ3k15oJ09IN4sxUnBwp4bVMW4RgGogpSuNaARYhqmyD1M
         ItEmVaUPl+oDPLfnryAdobDszjv3JqSEm5e/vQx9NeiCgD0+eSGEmYO9uyYIqGgx9oxp
         gxvw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-language:in-reply-to:user-agent:content-transfer-encoding
         :mime-version:references:message-id:lines:date:subject:from:to
         :arc-authentication-results;
        bh=XvEU8DNJ/G2XKqZIC4BaVEUDLihQ0skVxL4gFxEHqTU=;
        b=urFZaI2XyRAYe+OFqqg7Byn10QoLJlfXhbJkUgT2wRnLVubu5x7hCo1ScElk71MJrQ
         FQv96dI+dGNTXZbgMGY7TjVTXSS/7pnirGmYuTQcnuw/BnZeGDm2P0YF75aKBv9krdLe
         o27q6ZOjWoYTGdwcNSKk6LlAzgjvMxX1vlv6/KcU8nnFeQEjLIKdRxisnh4OPpkSDEvC
         iPfKSkrgf7958p2xyCHCLxAJgXz5RvuUyn3sGErRQ8o4GzsiJ1vhvIyQw3UPIYUOaSy9
         dJxd8kVwtfi2z+CyqWwu6vdfvX6SQeI8CtIcp/3C+Y8s3UzgMiEUCkBHYH4UiiBDKBJf
         DVzA==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
Original-Received: from blaine.gmane.org ([195.159.176.226])
        by mx.google.com with ESMTPS id m4si2421862lji.341.2018.03.26.17.03.27
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 26 Mar 2018 17:03:27 -0700 (PDT)
Received-SPF: neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) client-ip=195.159.176.226;
Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1f0c3C-0004ed-1E
	for std-proposals@isocpp.org; Tue, 27 Mar 2018 02:01:18 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 24
Original-X-Complaints-To: usenet@blaine.gmane.org
In-Reply-To: <a3462649-a7bd-4215-b162-e8fe922df02d@isocpp.org>
Content-Language: sv
X-Original-Sender: gclcip-std-proposals@m.gmane.org
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 195.159.176.226 is neither permitted nor denied by best guess
 record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
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:37486
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37486>

On 2018-03-26 22:26, Myriachan wrote:
> I would like to propose that C++ get a mechanism by which the magical 
> ability of std::complex<T> * to be reinterpret_cast to T * could be 
> allowed for other classes.
> 
> A simple case of this is a vector4 type:
> 
> struct vector3 { float x; float y; float z; float w; };
> 
> The performance difference is strong enough that our project actually 
> gets a much larger performance /increase/ from using 
> -fno-strict-aliasing versus -fstrict-aliasing with the changes required 
> for compliance.
> 

This is not what the std::complex magic requires from the compiler.

At least one implementation (MSVC) instead stores a two element array, 
which does away with any potential padding and also makes pointer 
arithmetic reasonable.


     Bo Persson


-- 
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/p9c1k7%24h28%241%40blaine.gmane.org.

.
