betterC: new operator

9il ilyayaroshenko at gmail.com
Tue Nov 24 17:11:15 UTC 2020


On Tuesday, 24 November 2020 at 17:02:27 UTC, 9il wrote:
> On Tuesday, 24 November 2020 at 11:22:30 UTC, Petar Kirov 
> [ZombineDev] wrote:>>
>> Nice! However, how do you initialize the vtbl of the extern 
>> (C++) class? I briefly had a look and mir.rc.ptr.createRC [1] 
>> calls mir.conv.emplace [2], which is a public import of 
>> core.lifetime.emplace, which as far as I can see uses typeinfo 
>> for that [3]. You also have a custom typeinfo implementation 
>> in mir.typeinfo [4], but I didn't see anything regarding 
>> initializing the vtbl pointer in there, just about the pointer 
>> to the destructor.
>
> `emplace` ref uses type info in compile time. This may not work 
> with betterC flag, I don't know. But it is a compile-time 
> constant, so TypeInfo isn't required to be generated into 
> executable.

Nevermind. Hmm, yes, you are right, it uses typeinfo to 
initialize the payload :/


More information about the Digitalmars-d mailing list