[webkit-dev] Stop Using Raw Pointers & References in New Code

Ryosuke Niwa rniwa at apple.com
Thu Jan 12 12:35:09 PST 2023


> 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());

- R. Niwa

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20230112/85908079/attachment.htm>


More information about the webkit-dev mailing list