[webkit-dev] Watch out for std::optional's move constructor

Chris Dumez cdumez at apple.com
Fri Dec 14 15:52:32 PST 2018


So to be clear, it is often not truly about using the value after it is moved. It is about expecting that the variable / member has been nulled out after moving it.
If I WTFMove() out a data member m_dataMember, I expect later on `if (m_dataMember)` to be false.

--
 Chris Dumez




> On Dec 14, 2018, at 3:45 PM, Chris Dumez <cdumez at apple.com> wrote:
> 
> 
>> On Dec 14, 2018, at 3:39 PM, Fujii Hironori <fujii.hironori at gmail.com <mailto:fujii.hironori at gmail.com>> wrote:
>> 
>> 
>> On Sat, Dec 15, 2018 at 6:38 AM Chris Dumez <cdumez at apple.com <mailto:cdumez at apple.com>> wrote:
>> 
>> I have now been caught twice by std::optional’s move constructor. 
>> 
>>  I don't understand how this could be useful? Do you want to use the value after it is moved? I'd like to see these your code. Could you show me these two patches?
> 
> This is the latest one: https://trac.webkit.org/changeset/239228/webkit <https://trac.webkit.org/changeset/239228/webkit>
> 
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20181214/68d29bae/attachment.html>


More information about the webkit-dev mailing list