[webkit-dev] size_t vs unsigned in WTF::Vector API ?

Carlos Garcia Campos carlosgc at webkit.org
Thu Nov 20 00:17:14 PST 2014

El mié, 19-11-2014 a las 12:20 -0800, Chris Dumez escribió:
> Hi all,
> I recently started updating the WTF::Vector API to use unsigned types
> instead of size_t [1][2], because:
> - WTF::Vector is already using unsigned type for size/capacity
> internally to save memory on 64-bit, causing a mismatch between the
> API and the internal representation [3]
> - Some reviewers have asked me to use unsigned for loop counters
> iterating over vectors (which looks unsafe as the Vector API, e.g.
> size(), returns a size_t).
> - I heard from Joseph that this type mismatch is forcing us (and other
> projects using WTF) to disable some build time warnings
> - The few people I talked to before making that change said we should
> do it

I started this [1] some time ago, copy pasting what Darin told me in a
review. Whatever we decide could be documented there.

> However, Alexey recently raised concerns about this change. it doesn't
> "strike him as the right direction. 4Gb is not much, and we should
> have more of WebKit work with the right data types, not less.”.
> I did not initially realize that this change was controversial, but
> now that it seems it is, I thought I would raise the question on
> webkit-dev to see what people think about this.
> Kr,
> --
> Chris Dumez - Apple Inc.
> Cupertino, CA
> [1] http://trac.webkit.org/changeset/176275
> [2] http://trac.webkit.org/changeset/176293
> [3] http://trac.webkit.org/changeset/148891

[1] http://trac.webkit.org/wiki/TypesForSize

More information about the webkit-dev mailing list