220 41484 <c3d59504-0492-91bb-4271-85fc9449d725@palves.net> article
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Pedro Alves <pedro@palves.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allow array as function return value
Date: Thu, 21 Feb 2019 11:48:16 +0000
Approved: news@gmane.org
Message-ID: <c3d59504-0492-91bb-4271-85fc9449d725@palves.net>
References: <e1c07ac6-73d0-40c8-98a0-60a5c8a6c575@isocpp.org>
 <CAM76qmtaaQtCP_+f5Z6B3jCsruZVzSR7Q6ezcVX=zMSjq4ujcQ@mail.gmail.com>
 <8a165c32-718a-4247-93b4-44235a2cf122@isocpp.org>
 <f870e6c5-4cb2-47f8-d963-363e68626841@gmail.com>
 <65d69c2c-3fa1-40a5-8120-53bfd345ac90@isocpp.org>
 <7eac0e9f-4042-45d6-93b3-de89ba4ebae0@isocpp.org>
Reply-To: std-proposals@isocpp.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="73352"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
To: std-proposals@isocpp.org, Nicol Bolas <jmckesson@gmail.com>
Original-X-From: std-proposals+bncBDRZRD7VU4BBBA5AXLRQKGQEUR5OMVI@isocpp.org Thu Feb 21 12:48:22 2019
Return-path: <std-proposals+bncBDRZRD7VU4BBBA5AXLRQKGQEUR5OMVI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm1-f71.google.com ([209.85.128.71])
	by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
	(Exim 4.89)
	(envelope-from <std-proposals+bncBDRZRD7VU4BBBA5AXLRQKGQEUR5OMVI@isocpp.org>)
	id 1gwmpx-000IuY-BU
	for gclcip-std-proposals@m.gmane.org; Thu, 21 Feb 2019 12:48:21 +0100
Original-Received: by mail-wm1-f71.google.com with SMTP id v7sf1614779wme.9
        for <gclcip-std-proposals@m.gmane.org>; Thu, 21 Feb 2019 03:48:21 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1550749700; cv=pass;
        d=google.com; s=arc-20160816;
        b=u3bvuXKG0Mw3+JyK/QHX6d7YdBZkpCw4b9/JePPpbEjPBpRGpiSyNbgc3k5ku85tcQ
         hMkfTxYfxGIjCoXehgwW9dFkBoj3sYS8UnT20UyhfabLoNRUExWWVOtN74LDQ+4P1bpw
         uFHbd/MvHvjuHKtIW9OLXjrN2gLbi7lj8UmDPEZL/QhMZfZYyQSY/2XL3Xh2ZmzzfvBL
         A0ZOxND2zklqvNKwwgly5YiGgDGToPCK2e28HmXkBPo+5NStMHQtgbYaid2TeO/1FUpJ
         sAof6gSlwa2vAncyoQhyXU0eA4C9Vo653dYweiVGWMT1s32irRQEFJhjnGBp4rXbWZt0
         Lksg==
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-transfer-encoding
         :content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:dkim-signature;
        bh=L7i2fO3FCOUKdmyS/4UI3hYWKgVBu5SpQ0jDhMyD80E=;
        b=SDvzGulFewaKKVcmvDeMQS7hE/QjK/WwKM19l2AV4/QGF3Wex3BVMB5tjHPeDgaUfq
         rGQOZK6ZdxHhjym+FJnGgZtsvjNZTi4cTHItihFem6KRpd8Us9Zk4lxNlGyVv3v6OPMr
         XwPtqrug4+4FFWB4iO5is6i692fU41DP+mdbyljhOGr/gB7zhod1giVyTSYJtdBtWLWe
         CF7glnLn8MVgf/6Bq9oT+koekluyS/Y95cCXZA+OdqLI6Bw06cJCe33+HSvdFhifl5sO
         0k1MsZCzY4pdeShryngTDuEz6ArvZFii4TLjRhK+34n+5MnDNlzpTiIeOPwTakNJZ/SN
         Y6CQ==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of alves.ped@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=alves.ped@gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-language:content-transfer-encoding
         :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=L7i2fO3FCOUKdmyS/4UI3hYWKgVBu5SpQ0jDhMyD80E=;
        b=CqNr67llHe9hqy0qLZv3EYYKPbBc6bszQOEhd5tHQn5t2y59S63o/TErJJyaRcW9hj
         0GUsZnUg823gQ/QIVCf8fHUzYiF9ODHlnjlu57aI3w/hJDQWkcU8xzec0n4kPfl+MGHd
         AdSu+e3cvPmtzQu8oP+qgQIQLXx8QpiQSi4y+Tt56ZJPor3Akr0N2LnVyXyInurB5S/p
         39zLohgcvCtfUj2VEr+H/ynIjDs+llZ8CV+H9gfXLXlar8CMh+PhFmruszWzJEBG4Fbl
         wXiBtHBIyPfv7i/N/UI8RL8M48a9ygmwcQWJx8GS7PC8Cq9RdbOzL4cpUHKbRIbA1vDd
         VtQ 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :content-transfer-encoding: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=L7i2fO3FCOUKdmyS/4UI3hYWKgVBu5SpQ0jDhMyD80E=;
        b=QZFqOwAepORJd8hBw5WjhHD6bGj7WjzD6rzo9Ljsuj2IB3Cbza9jJJkXQ8KMyBZuxB
         rej0cLqnd1ha2GJzEhNVPzyq6txbAAKeipws9IOh/VEIb43XW78WRKH0aN0fnwh6VaVg
         AZeNDGYs4AZIyuS08boDuFOrrJjI5F6sWSkFVg1XavvbOrhU5wchKRHMCJ6R0NOfe+Ew
         350liNck2rosATM0fJyaXJkVQlf0L2PDYIJ3+DybxzqDAK/mbhFe+nM/r8Tmys6Y7pOv
         qssnNpWhXjfeeV7KbX/2Er3fpBOIQQ1Edm8134pATLB 
X-Gm-Message-State: AHQUAuZxwTUYy2+2zOijmPAfgY1aVdwYFVfqYTBampn9MxueHrhse51q
	pqD6ovBLfUsd+1wqU330krMmJg==
X-Google-Smtp-Source: AHgI3IZQGJnqI3JvT9mqeDsyjEYutn65ZouFiP1dxOA6Q3olEhIocBUvAZbU6HsFIXh52ypB2gA7ng==
X-Received: by 2002:a1c:f107:: with SMTP id p7mr981060wmh.12.1550749700509;
        Thu, 21 Feb 2019 03:48:20 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a1c:ce0a:: with SMTP id e10ls268883wmg.1.canary-gmail; Thu,
 21 Feb 2019 03:48:18 -0800 (PST)
X-Received: by 2002:a1c:e489:: with SMTP id b131mr9690561wmh.130.1550749698589;
        Thu, 21 Feb 2019 03:48:18 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1550749698; cv=none;
        d=google.com; s=arc-20160816;
        b=yXJybNafg2VAAL5v45KTo1cffLc2nYdhzZdfTUwFS50hlMd0yjh8Bx0ItVYCddY0o6
         r7s5xNcD023llln0GRgmfCLtt+dFeNQEjLXbrbXSB563jO16dsm4cMuosy1Iu3ri58ct
         FM25S93BGHLjgyc5bT9IY5CXUXJDJpnxtoIu5E1zTYAPWyxTHceoMaO6rSQn+BBS/25D
         XWXB6BC3on8fWxpuT2K/QK/BCpO3eilFBRAW6O+05avwoaW+BnLJedV/Er3x079Mz5Qv
         i482VnZaIDoYBw1kL+UnBEW3JCR3aTFLtst7IK+WQEZHnUWQyjGZ11Fbcqxr2brkPH45
         SPMA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:to:subject;
        bh=b7KbN1uyyaBtF0WgM7tskUKdmdculqOuCOJluoDPJK0=;
        b=cMgfaxMYUEjMkXm6P/f2lI8Dvd42z3+gzJ3KJ1GG2b4TYVSh8aKCMMuUhMTZPGuU8G
         D/SHgCajOtdNwwfaU6Uwo0FjPvVYFUZdDk33y+JEvt25UA/E3+enU6wVNpQm742PYDJq
         WZ2YgOJdfZPJwPsAMFmWOP1EbfpsmfbfD8pEUJkLiLM3Jgu71uHaNjeqCXsvaTRfxpir
         hYNm5ZXNoYyWESmXu8vKMKeOsVKQ9sQJN0Ctz3BMl/qAD3YWZUBIH1N79JszLONHNvGQ
         nqciUL0rmGCMcNX1DTATOhT/AmNmQ4n+68s07gPpLkOnV99jqY38Gh7fg2zY583Aw9/t
         TUAA==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of alves.ped@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=alves.ped@gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id y202sor3126907wmd.1.2019.02.21.03.48.18
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Thu, 21 Feb 2019 03:48:18 -0800 (PST)
Received-SPF: pass (google.com: domain of alves.ped@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a1c:720f:: with SMTP id n15mr9353212wmc.64.1550749697860;
        Thu, 21 Feb 2019 03:48:17 -0800 (PST)
Original-Received: from ?IPv6:2001:8a0:f913:f700:75e6:857f:3506:a1f4? ([2001:8a0:f913:f700:75e6:857f:3506:a1f4])
        by smtp.gmail.com with ESMTPSA id h17sm16489192wrq.17.2019.02.21.03.48.17
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 21 Feb 2019 03:48:17 -0800 (PST)
In-Reply-To: <7eac0e9f-4042-45d6-93b3-de89ba4ebae0@isocpp.org>
Content-Language: en-US
X-Original-Sender: pedro@palves.net
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of alves.ped@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=alves.ped@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: <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:41484
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/41484>

On 02/20/2019 03:55 AM, Nicol Bolas wrote:
>=20
> On a personal level, the biggest problem I have with increasing the use o=
f C-arrays is syntactic. Just look at one of your examples:
>=20
> char abc1D()[3] { return {'a','b','c'}; }
>=20
> If the `[3]` applies to the `char` as part of the return type, why is it =
on the other side of the function name? The return type should be either on=
 the left or the right; it shouldn't be scattered between them. My first th=
ought was that you were somehow creating an array of functions, not a funct=
ion that returns an array.

Not arguing for this in any way, but I'd think that
syntax-wise, this would be much clearer:

 auto abc1D()-> char[3] { return {'a','b','c'}; }

Curiously, seems like that actually compiled with GCC up until v7.  See:

  https://godbolt.org/z/aE5l8I

gcc 8 errors out with
 error: 'abc1D' declared as function returning an array
and clang errors out with
 error: function cannot return array type 'char [3]'

Pedro Alves

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/c3d59504-0492-91bb-4271-85fc9449d725%40palves.ne=
t.

.
