This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: valgrind confused by std::allocator calls to operator new(0)
Nathan Myers <ncm-nospam@cantrip.org> writes:
| On Tue, Feb 22, 2005 at 02:40:04PM +0100, Gabriel Dos Reis wrote:
| > Michael Veksler <VEKSLER@il.ibm.com> writes:
| >
| > | Is it possible/reasonable to change new_allocator::allocate such that
| > | it returns NULL when __n ==0 ? Should I open a PR against libstdc++?
| >
| > Yes, please.
|
| No, the bug is in valgrind, because zero arguments to the allocators
| are explicitly allowed.
I do *not* disagree that allocators should correctly handle argument
value 0. My understanding is that libstdc++ is misbehaviour, which is
why I think a PR should be open against libstdc++.
| If we choose to work around the valgrind bug,
| the workaround belongs in std::vector, not in the allocators. (It is
| a minor optimization, anyway, to avoid performing an allocation when
| copying an empty vector.)
|
| Nathan Myers
| ncm@cantrip.org
--
Gabriel Dos Reis
gdr@integrable-solutions.net