RESOLVED FIXED138842
Have Vector::capacity() return an unsigned instead of a size_t
https://bugs.webkit.org/show_bug.cgi?id=138842
Summary Have Vector::capacity() return an unsigned instead of a size_t
Chris Dumez
Reported 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.
Attachments
Patch (8.47 KB, patch)
2014-11-18 13:22 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2014-11-18 13:22:01 PST
Andreas Kling
Comment 2 2014-11-18 15:40:01 PST
Comment on attachment 241807 [details] Patch r=me
WebKit Commit Bot
Comment 3 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>
WebKit Commit Bot
Comment 4 2014-11-18 16:17:25 PST
All reviewed patches have been landed. Closing bug.
Alexey Proskuryakov
Comment 5 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.
Chris Dumez
Comment 6 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.
Andreas Kling
Comment 7 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.
Geoffrey Garen
Comment 8 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?
Antti Koivisto
Comment 9 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?
Note You need to log in before you can comment on or make changes to this bug.