Re: [webkit-dev] Unsigned to avoid negative values

2023-01-24 Thread Michael Catanzaro via webkit-dev
On Tue, Jan 24 2023 at 02:00:11 AM -0800, Myles Maxfield via webkit-dev wrote: What do you think? This has been a best practice for a long time now. It's a good rule to reduce bugs if adopted consistently, but I also fear that if we were to try to adapt existing WebKit code to follow these

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

2023-01-24 Thread Alicia Boya García via webkit-dev
On 12/01/2023 06.21, Ryosuke Niwa via webkit-dev wrote: I suggest we *stop using raw pointers and references in any local or heap stored variable*. I don't think this is feasible for code using non-WebKit libraries, and would expect it to not apply to such cases. For instance, many GLib and

[webkit-dev] Unsigned to avoid negative values

2023-01-24 Thread Myles Maxfield via webkit-dev
Hello! I recently learned that the C++ core guidelines recommend against using unsigned to avoid negative values. Section 4.4 on page 73 of The C++ Programming Language says unsigned types should be used for bitfields and not in an attempt to ensure values are positive. Some talks by people on

Re: [webkit-dev] Unsigned to avoid negative values

2023-01-24 Thread Jean-Yves Avenard via webkit-dev
I could have sworn reading a few years ago a white paper discussing signed vs unsigned discussed with Blink coding style showing that using unsigned had a performance impact. Of course, now I can’t find reference to it. But I clearly recall recommendations like you mentioned. Sent from my

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

2023-01-24 Thread Michael Catanzaro via webkit-dev
Hm, I see you're right because CheckedRef/CheckedPtr are intrusive pointers that require modification of the type to be pointed to, so they are not going to work in general as they cannot be used for types that do not inherit from CanMakeCheckedRef/CanMakeCheckedPtr.

Re: [webkit-dev] Unsigned to avoid negative values

2023-01-24 Thread Chris Dumez via webkit-dev
Hi, What’s the benefit? I don’t think we should be changing our long-time coding practices unless there are clear benefits from doing so. From your email, it is not yet clear to me what those benefits would be. Chris. > On Jan 24, 2023, at 6:58 AM, Michael Catanzaro via webkit-dev > wrote: >

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

2023-01-24 Thread Ryosuke Niwa via webkit-dev
> On Jan 24, 2023, at 5:30 AM, Alicia Boya García via webkit-dev > wrote: > > On 12/01/2023 06.21, Ryosuke Niwa via webkit-dev wrote: >> I suggest we stop using raw pointers and references in any local or heap >> stored variable. > I don't think this is feasible for code using non-WebKit

Re: [webkit-dev] Unsigned to avoid negative values

2023-01-24 Thread Ryosuke Niwa via webkit-dev
> On Jan 24, 2023, at 2:00 AM, Myles Maxfield via webkit-dev > wrote: > > I recently learned that the C++ core guidelines recommend against using > unsigned to avoid negative values. Section 4.4 on page 73 of The C++ > Programming Language says unsigned types should be used for bitfields and

Re: [webkit-dev] Unsigned to avoid negative values

2023-01-24 Thread Anne van Kesteren via webkit-dev
On Tue, Jan 24, 2023 at 11:00 AM Myles Maxfield via webkit-dev wrote: > What do you think? What this immediately made me think of is that Web IDL and the web platform at large use unsigned and signed integers of various types. And as those have different value spaces you'd notice if you do

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

2023-01-24 Thread Michael Catanzaro via webkit-dev
On Tue, Jan 24 2023 at 11:33:45 AM -0800, Ryosuke Niwa via webkit-dev wrote: That’s also the semantics of Ref/RefPtr in WebKit. But we’re expanding the use of Ref/RefPtr to be beyond just owners for memory safety. I don’t see how the situation is any different with GRefPtr/GUniquePtr. If an