C++ Logo

std-proposals

Advanced search

Re: Conditional final class-virt-specifier

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 15 Jul 2020 19:46:28 +0300
On Wed, 15 Jul 2020 at 19:30, Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On Wednesday, 15 July 2020 08:02:54 PDT Arthur O'Dwyer via Std-Proposals
> wrote:
> > the keyword doesn't really *do* anything except documentation
>
> It could allow the compiler to devirtualise function calls, since a pointer to
> a final class can only point to an object of that particular class.

"Does" rather than "could". GCC does devirtualize calls with the help
of the keyword, that's implementation-wise
why its handling was moved from C++-specific parts of the compiler to
the less-language-specific ones because
the middle-end prefers it to be expressed that way.

Received on 2020-07-15 11:49:56