DIP77 - Fix unsafe RC pass by 'ref'
Michel Fortin via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 10 19:41:59 PDT 2015
On 2015-04-10 23:22:17 +0000, "deadalnix" <deadalnix at gmail.com> said:
> On Friday, 10 April 2015 at 23:18:59 UTC, Martin Nowak wrote:
>> On 04/10/2015 11:29 PM, Walter Bright wrote:
>>>
>>> The latter.
>>
>> Can you update that part in the DIP, it wasn't clear that the temporary
>> selectively pins RCO fields of a normal struct passed by ref.
>
> If a struct has RCO fields, shouldn't it be an RCO itself, and as such
> be pinned ?
Not necessarily. A @disabled postblit could make it no longer RCO
(including a @disabled postblit in one of the fields).
> It sounds like this is implied in the DIP.
That's what I thought too. But when confronted to a case where that
wouldn't work Walter said in this thread that the compiler would make a
temporary of the fields. So I'm not too sure what to think anymore. The
DIP should clarify what happens with @disabled postblit and RCO fields
inside non-RCO structs.
--
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca
More information about the Digitalmars-d
mailing list