[webkit-dev] unsigned versus size_t in WTFString.h

Adam Barth abarth at webkit.org
Wed Sep 7 02:47:36 PDT 2011


Thanks Gavin.  This guidance is very helpful.

Adam


On Wed, Sep 7, 2011 at 2:38 AM, Gavin Barraclough <barraclough at apple.com> wrote:
> Hi Adam,
>
> Yes, I believe our current thinking is that the external interface to String lengths / indices should all be in size_t (though unless we believe we need to support strings > 4GB we should keep the length stored as a 32 bit value internally).  There are a couple of bugzilla bugs relevant, though I don't think either currently capture exactly this.
>
> https://bugs.webkit.org/show_bug.cgi?id=49637
> https://bugs.webkit.org/show_bug.cgi?id=60279
>
> cheers,
> G.
>
>
> On Sep 6, 2011, at 9:12 PM, Adam Barth wrote:
>
>> I wanted to confirm my understanding before going too far off into the
>> woods: Most of the uses of "unsigned" in WTFString.h should really be
>> "size_t", right?
>>
>> http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/text/WTFString.h
>>
>> For example,
>>
>> unsigned length() const
>>
>> should be
>>
>> size_t length() const
>>
>> and
>>
>> size_t find(UChar c, unsigned start = 0) const
>>
>> should be
>>
>> size_t find(UChar c, size_t start = 0) const
>>
>> (Obviously some, like "static String number(unsigned)", should stay as
>> unsigned.)
>>
>> Thanks,
>> Adam
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>


More information about the webkit-dev mailing list