How to get to a class initializer through introspection?

Johan j at
Tue Aug 4 09:31:16 UTC 2020

On Tuesday, 4 August 2020 at 02:03:34 UTC, Andrei Alexandrescu 
> On 8/3/20 10:44 AM, Johan wrote:
>> On Monday, 3 August 2020 at 13:01:55 UTC, Andrei Alexandrescu 
>> wrote:
>>> Would it be effective to iterate through the .tupleof and 
>>> initialize each in turn?
>> Possibly. IIRC, the spec obliges us to initialize the padding 
>> in-between address-aligned members aswell, such that a memcmp 
>> works to compare structs. If that is true, then we have to 
>> initialize the padding aswell and a memcpy would be that much 
>> nicer.
> To play devil's advocate, the padding bytes should not have 
> been changed by user code in the first place :o).

But the memory into which objects are placed will be tainted and 
thus the padding areas will not be the same for each object. 
(it's the same for =void members. All can be incorporated into 
the initializer function, but it's work.)


More information about the Digitalmars-d mailing list