C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Give Microsoft N years to change their ABI

From: Robin Savonen Söderholm <robinsavonensoderholm_at_[hidden]>
Date: Thu, 14 Nov 2024 13:21:18 +0100
And your void* may not point to something using a VTable at all... No, the
standard will not enable this as "void *" is the old, unsafe, "C-way" of
doing dynamic polymorphisms. Today, you either use runtime type-erasure
(like inheritance with virtual functions or std:: variant) or templates for
compile time polymorphisms. I don't understand why you would even _have_ a
void* to something with a VTable, especially under circumstances where you
_know_ that whatever void* is has a VTable...

On Thu, Nov 14, 2024, 12:42 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> The C++ programming language is held back by the Microsoft compiler's
> implementation of VTables. Every other C++ compiler places the pointer
> to the VTable right at the beginning of the object, but the Microsoft
> compiler sometimes places it elsewhere. This has the following
> consequences:
>
> (1) Cannot use dynamic_cast on a void*
>
> Assuming that we have a void* pointer that points to a polymorphic
> object, we would be able to use dynamic_cast on it to perform a
> side-cast or down-cast (or to get the most-derived object).
>
> (2) Cannot get the type_info from a void*
>
> Assuming that we have a void* pointer that points to a polymorphic
> object, we would be able to get its type_info.
>
> I think the committee should consider giving Microsoft a certain
> amount of time to change this. I realise that the Standard doesn't
> mention 'Microsoft' in its text but the committee could make the
> decision that in C++36, the above two points are possible (which would
> mean that MS have to change their ABI by then).
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-11-14 12:21:30