Date: Thu, 14 Nov 2024 13:20:36 +0000
On 14 November 2024 13:15:54 GMT, Egor via Std-Proposals <std-proposals_at_[hidden]> wrote:
>If I'm not mistaken, multiple inheritance can cause the vtable to be at a non-zero offset on all compilers (if the first base isn't polymorphic).
AFAIK Itanium reorders the bases in this case. But if you have multiple polymorphic bases, then one of the vtable pointers is surely not at offset 0.
>
>14.11.2024 16:42, Frederick Virchanza Gotham via Std-Proposals пишет:
>> 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).
>If I'm not mistaken, multiple inheritance can cause the vtable to be at a non-zero offset on all compilers (if the first base isn't polymorphic).
AFAIK Itanium reorders the bases in this case. But if you have multiple polymorphic bases, then one of the vtable pointers is surely not at offset 0.
>
>14.11.2024 16:42, Frederick Virchanza Gotham via Std-Proposals пишет:
>> 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).
Received on 2024-11-14 13:20:39