This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Fix vector wrt __len overflows
On Tue, 2004-10-19 at 22:44, Paolo Carlini wrote:
> Nathan Myers wrote:
>
> >Shouldn't we just try to allocate as much as we can, instead?
Would allocating the maximum help here?
I guess not because what we need is more than the maximum.
Then, again I could be wrong.
> >
> >That hypothetical 16-bit machine might have 32-bit addresses and
> >be able to allocate a full 64K for each vector.
> >
> Well, if you really think we support such machines... ;)
> Then the condition would become:
>
> if (__len < __old_size)
> __len = size_type(-1);
>
> and the allocator will throw bad_alloc, in case... Ok, makes sense.
>
> Paolo.
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
The price of freedom is responsibility, but it's a bargain, because
freedom is priceless. ~ Hugh Downs