This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix vector wrt __len overflows


Nathan Myers wrote:

Shouldn't we just try to allocate as much as we can, instead?

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]