Date: Fri, 10 Nov 2023 03:48:11 +0200
On Fri, 10 Nov 2023 at 03:22, Smith, Jim via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Hi All,
>
> Test-driven development (TDD) is my de facto standard for writing software. On some projects I can't use TDD because interfaces introduce VTBL operation into the code. For me this is a serious issue.
>
> I've always used C++ interfaces i.e., classes with all pure virtual functions for TDD, especially when implementing a design patterns like Factory.
>
> I'm proposing a compiler option that will turn a virtual call through an interface, to a direct call on the object. For example,
>
> interface* i = Factory::Create();
>
> i->someVirtualFunc();
>
> In cases where single inheritance is used i->someVirtualFunc() would be optimized to a direct call on the object without any VTBL operation.
What do you mean "single inheritance is used"? You mean, across all
your translation units, everywhere in your program?
That's not something that the standard can talk about. Talk to your
vendor, have them LTO-optimize this case.
<std-proposals_at_[hidden]> wrote:
>
> Hi All,
>
> Test-driven development (TDD) is my de facto standard for writing software. On some projects I can't use TDD because interfaces introduce VTBL operation into the code. For me this is a serious issue.
>
> I've always used C++ interfaces i.e., classes with all pure virtual functions for TDD, especially when implementing a design patterns like Factory.
>
> I'm proposing a compiler option that will turn a virtual call through an interface, to a direct call on the object. For example,
>
> interface* i = Factory::Create();
>
> i->someVirtualFunc();
>
> In cases where single inheritance is used i->someVirtualFunc() would be optimized to a direct call on the object without any VTBL operation.
What do you mean "single inheritance is used"? You mean, across all
your translation units, everywhere in your program?
That's not something that the standard can talk about. Talk to your
vendor, have them LTO-optimize this case.
Received on 2023-11-10 01:48:25