Bug 138842 - Have Vector::capacity() return an unsigned instead of a size_t
Summary: Have Vector::capacity() return an unsigned instead of a size_t
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-18 13:19 PST by Chris Dumez
Modified: 2014-11-24 03:24 PST (History)
8 users (show)

See Also:


Attachments
Patch (8.47 KB, patch)
2014-11-18 13:22 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2014-11-18 13:19:00 PST
Have Vector::capacity() return an unsigned instead of a size_t as capacity is stored as an unsigned internally.
Comment 1 Chris Dumez 2014-11-18 13:22:01 PST
Created attachment 241807 [details]
Patch
Comment 2 Andreas Kling 2014-11-18 15:40:01 PST
Comment on attachment 241807 [details]
Patch

r=me
Comment 3 WebKit Commit Bot 2014-11-18 16:17:20 PST
Comment on attachment 241807 [details]
Patch

Clearing flags on attachment: 241807

Committed r176293: <http://trac.webkit.org/changeset/176293>
Comment 4 WebKit Commit Bot 2014-11-18 16:17:25 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Alexey Proskuryakov 2014-11-18 21:29:22 PST
Just as commented in another bug, this seems like the wrong direction to me. 4Gb is not enough for everyone, why bring more of WebKit back to Stone Age.
Comment 6 Chris Dumez 2014-11-18 21:31:26 PST
(In reply to comment #5)
> Just as commented in another bug, this seems like the wrong direction to me.
> 4Gb is not enough for everyone, why bring more of WebKit back to Stone Age.

Sorry about that. I wasn't aware this was controversial. I was annoyed by the fact that Vector uses unsigned types internally but its API still uses size_t.
Comment 7 Andreas Kling 2014-11-18 23:22:12 PST
(In reply to comment #5)
> Just as commented in another bug, this seems like the wrong direction to me.
> 4Gb is not enough for everyone, why bring more of WebKit back to Stone Age.

The majority of Vector's clients will never need to store 4GiB or more.

It seems better to build something special-purpose if/when we do need dynamic arrays with that much capacity.

Also, making Vector strictly "unsigned" unifies the behavior between 32-bit and 64-bit platforms.
Comment 8 Geoffrey Garen 2014-11-19 11:30:16 PST
If we are going to limit Vector to 4GB, can we at least add a RELEASE_ASSERT upon grow that says we're not going to overflow the 4GB limit?
Comment 9 Antti Koivisto 2014-11-24 03:24:01 PST
Perhaps the constructor and the functions that expand size should still take size_t so we can crash on overflows?