220 13240 <8DC1AED8-83B6-453A-A93A-EAB6AF942968@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Tighten rules for virtual override keyword combination
Date: Sun, 28 Sep 2014 14:07:32 +0800
Lines: 111
Approved: news@gmane.org
Message-ID: <8DC1AED8-83B6-453A-A93A-EAB6AF942968@gmail.com>
References: <19267205-7e26-4c12-b9b4-f26ab2f99eb7@isocpp.org> <803262EF-88B4-40B0-AC9B-7C7356CDE56A@gmail.com> <fa6760c6-0adc-4fca-9dad-2bfca08f19de@isocpp.org> <54274B57.6040007@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_87C2A59F-4EE5-4F60-8FA2-DEC6E1CD7A2E"
X-Trace: ger.gmane.org 1411884480 13644 80.91.229.3 (28 Sep 2014 06:08:00 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 28 Sep 2014 06:08:00 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBMWLT2QQKGQEY5F2P5A@isocpp.org Sun Sep 28 08:07:49 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBMWLT2QQKGQEY5F2P5A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f71.google.com ([209.85.220.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBMWLT2QQKGQEY5F2P5A@isocpp.org>)
	id 1XY7e9-0001m1-0q
	for gclcip-std-proposals@m.gmane.org; Sun, 28 Sep 2014 08:07:49 +0200
Original-Received: by mail-pa0-f71.google.com with SMTP id rd3sf12779788pab.10
        for <gclcip-std-proposals@m.gmane.org>; Sat, 27 Sep 2014 23:07:47 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:mime-version:subject:date
         :references:to:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=EcEeVyOey8uIeZaDm9EgtY2Iyb0RjbtfQTL9jgZj21w=;
        b=MdcFK9teFn62OKe3kBt7N8hNoMeWmKjQcbMFsEGmHEe8flhI9c29vh1e7amFiIoT5T
         ZH3LoJBLD850QDLCdDlvFeL/Wc8tPYM6B7INEzkISzLVFPLhLN3mhlNMOmPmp5Bu40UC
         YrEENXKPiZo5J/F9TkoLeiy/krrT3mCAQpW+ODbd9eA11DGzi2IgGjMMcdID/+QnJnIc
         wKNnLbi9CMQVX3Fw0Szdl9s5Dg+SI+7ldSJxU5MEEgQAVTPx4Qp0RPr87oOsaFmX95T7
         wYBqplfsUmu9w5xv3aG48FYkEp5WThGAWXw/OLacDF451pUNbWrK0qkZusnTrAF+z4Hu
         fYYw==
X-Gm-Message-State: ALoCoQk6ORiVg2Q65QZ79VefiAR0uT4A645Czxv8dG7dJo8HXcHk9SkvXLy5aoTR1Uu6quluLYuW
X-Received: by 10.66.66.196 with SMTP id h4mr26184112pat.18.1411884467195;
        Sat, 27 Sep 2014 23:07:47 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.23.8 with SMTP id i8ls1460430igf.34.canary; Sat, 27 Sep
 2014 23:07:46 -0700 (PDT)
X-Received: by 10.70.16.2 with SMTP id b2mr62348408pdd.36.1411884466611;
        Sat, 27 Sep 2014 23:07:46 -0700 (PDT)
Original-Received: from mail-pd0-x22c.google.com (mail-pd0-x22c.google.com [2607:f8b0:400e:c02::22c])
        by mx.google.com with ESMTPS id pq1si17027756pac.109.2014.09.27.23.07.46
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 27 Sep 2014 23:07:46 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c02::22c as permitted sender) client-ip=2607:f8b0:400e:c02::22c;
Original-Received: by mail-pd0-f172.google.com with SMTP id g10so3420047pdj.31
        for <std-proposals@isocpp.org>; Sat, 27 Sep 2014 23:07:46 -0700 (PDT)
X-Received: by 10.66.159.8 with SMTP id wy8mr47345516pab.17.1411884466424;
        Sat, 27 Sep 2014 23:07:46 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.39])
        by mx.google.com with ESMTPSA id hs8sm8944522pbc.35.2014.09.27.23.07.44
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 27 Sep 2014 23:07:45 -0700 (PDT)
In-Reply-To: <54274B57.6040007@gmail.com>
X-Mailer: Apple Mail (2.1878.6)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:400e:c02::22c as permitted
 sender) smtp.mail=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:13240
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/13240>

--Apple-Mail=_87C2A59F-4EE5-4F60-8FA2-DEC6E1CD7A2E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 2014-09-28, at 7:42 AM, germinolegrand <germinolegrand@gmail.com> wrote:

> - when i see virtual, i know it's the base definition

I proposed a while ago on this list to define !override (or not override) t=
o provide a base definition, and !final (or not final) as a less obtuse syn=
onym for =3D 0, which would not preclude =3D default for destructors. There=
 was little interest.

C++ does not currently have a way to declare base definitions, so every der=
ived class is at the mercy of its bases and even their inaccessible members=
..


On 2014-09-28, at 1:50 PM, 'Geoffrey Romer' via ISO C++ Standard - Future P=
roposals <std-proposals@isocpp.org> wrote:

> Note that in the case of 'final', the presence or absence of 'virtual' ma=
kes an important semantic difference: without the 'virtual', it behaves lik=
e 'override', so you get an error if it doesn't override a virtual method i=
n the base class. Adding 'virtual' suppresses that error, which is almost n=
ever what you want. This makes "use exactly one of the three" a pretty good=
 rule of thumb.


I wonder why implementations don't warn on a non-override final definition,=
 and why override isn't implicit in final in the first place. It's too late=
 to change now, but where's the use case? It has the effect of reserving a =
name from derived classes, I suppose, but such a thing doesn't belong in th=
e vtable at all.

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_87C2A59F-4EE5-4F60-8FA2-DEC6E1CD7A2E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;09&ndash;28, at 7:42 AM, germinolegrand &lt;<a href=3D"mailto:germino=
legrand@gmail.com">germinolegrand@gmail.com</a>&gt; wrote:</div><br class=
=3D"Apple-interchange-newline"><blockquote type=3D"cite"><span style=3D"fon=
t-family: Helvetica; font-size: 12px; font-style: normal; font-variant: nor=
mal; font-weight: normal; letter-spacing: normal; line-height: normal; orph=
ans: auto; text-align: start; text-indent: 0px; text-transform: none; white=
-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width:=
 0px; float: none; display: inline !important;">- when i see virtual, i kno=
w it's the base definition</span><br style=3D"font-family: Helvetica; font-=
size: 12px; font-style: normal; font-variant: normal; font-weight: normal; =
letter-spacing: normal; line-height: normal; orphans: auto; text-align: sta=
rt; text-indent: 0px; text-transform: none; white-space: normal; widows: au=
to; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote></div>=
<br><div>I proposed a while ago on this list to define <font face=3D"Courie=
r">!override</font> (or <font face=3D"Courier">not override</font>) to prov=
ide a base definition, and <font face=3D"Courier">!final</font>&nbsp;(or <f=
ont face=3D"Courier">not final</font>) as a less obtuse synonym for <font f=
ace=3D"Courier">=3D 0</font>, which would not preclude&nbsp;<font face=3D"C=
ourier">=3D default</font> for destructors. There was little interest.</div=
><div><br></div><div>C++ does not currently have a way to declare base defi=
nitions, so every derived class is at the mercy of its bases and even their=
 inaccessible members.</div><div><br></div><div><br></div><div><div>On 2014=
&ndash;09&ndash;28, at 1:50 PM, 'Geoffrey Romer' via ISO C++ Standard - Fut=
ure Proposals &lt;<a href=3D"mailto:std-proposals@isocpp.org">std-proposals=
@isocpp.org</a>&gt; wrote:</div><br class=3D"Apple-interchange-newline"><bl=
ockquote type=3D"cite">Note that in the case of 'final', the presence or ab=
sence of 'virtual' makes an important semantic difference: without the 'vir=
tual', it behaves like 'override', so you get an error if it doesn't overri=
de a virtual method in the base class. Adding 'virtual' suppresses that err=
or, which is almost never what you want. This makes "use exactly one of the=
 three" a pretty good rule of thumb.<br class=3D"Apple-interchange-newline"=
></blockquote></div><div><br></div><div>I wonder why implementations don&rs=
quo;t warn on a non-override <font face=3D"Courier">final</font> definition=
, and why <font face=3D"Courier">override</font> isn&rsquo;t implicit in <f=
ont face=3D"Courier">final</font> in the first place. It&rsquo;s too late t=
o change now, but where&rsquo;s the use case? It has the effect of reservin=
g a name from derived classes, I suppose, but such a thing doesn&rsquo;t be=
long in the vtable at all.</div><div><br></div></body></html>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_87C2A59F-4EE5-4F60-8FA2-DEC6E1CD7A2E--

.
