[webkit-dev] Stop Using Raw Pointers & References in New Code
Darin Adler
darin at apple.com
Thu Jan 12 13:27:45 PST 2023
> On Jan 12, 2023, at 3:35 PM, Ryosuke Niwa via webkit-dev <webkit-dev at lists.webkit.org> wrote:
>
>> On Jan 12, 2023, at 6:13 AM, Darin Adler <darin at apple.com> wrote:
>>
>>> On Jan 12, 2023, at 12:21 AM, Ryosuke Niwa via webkit-dev <webkit-dev at lists.webkit.org> wrote:
>>>
>>> assuming every local variable / variable in stack is stored in a smart pointer, function arguments are safe to be raw pointers / references via transitive property
>>
>> What about the case where the function argument is the return value from another function?
>
> In those cases, the value should be stored in a local variable using a smart pointer first.
>
> So… instead of:
> foo(bar());
>
> do:
> foo(RefPtr { bar() }.get());
This seems impractical. How will I remember to do this?
— Darin
More information about the webkit-dev
mailing list