Help with DMD internals

Manu turkeyman at gmail.com
Mon May 21 22:18:41 UTC 2018


On 21 May 2018 at 06:10, Steven Schveighoffer via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 5/20/18 9:49 PM, Manu wrote:
>>
>> On 20 May 2018 at 17:14, Walter Bright via Digitalmars-d
>> <digitalmars-d at puremagic.com> wrote:
>>>
>>> On 5/20/2018 12:28 PM, Manu wrote:
>>>>
>>>>
>>>>     Is re-initialisation to 'init' part of destruction,
>>>
>>>
>>>
>>> No.
>>>
>>>> or is it a
>>>> separate post-process? (I feel it's a post-process)
>>>
>>>
>>>
>>> Yes, and only for delete.
>
>
> Why? This doesn't make a lot of sense, since delete is freeing the memory,
> it shouldn't matter what state the memory is left in. I would argue that
> should only be done in debug mode, and actually, I wonder if some other kind
> of sentinel memory pattern should be written instead.
>
>>
>> destroy() also seems to do it.
>>
>
> Yes, because destroy leaves the memory available for reuse. This is
> intentional.

It's uninitialised memory though, Wouldn't the same argument you made
above also apply?


More information about the Digitalmars-d mailing list