This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [libstdc++] Problems with deques (patch included)
- From: Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
- To: Gabriel Dos Reis <gdr at codesourcery dot com>
- Cc: <libstdc++ at gcc dot gnu dot org>, <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 8 Jul 2002 13:14:56 +0200 (CEST)
- Subject: Re: [libstdc++] Problems with deques (patch included)
|This unncessarily breaks ABI. It is better to reorder the
|base-initialiser-list insteads of the data member declaration.
I deliberately reordered the data member declarations in such a way
to remove an abi breaking change with respect to the deque class
that is shipped with gcc 3.1. I believe abi changes with respect to
different libstdc++ version should be minimized, therefore I suggested
the patch.
The template <class _Tp, class _Alloc, bool __is_static>
class _Deque_alloc_base class from libstdc++ 3.1 has the layout:
(cf. lines 240ff from stl_deque.h)
allocator_type _M_node_allocator;
_Map_allocator_type _M_map_allocator;
_Tp* _M_allocate_node() {
return _M_node_allocator.allocate(__deque_buf_size(sizeof(_Tp)));
}
void _M_deallocate_node(_Tp* __p) {
_M_node_allocator.deallocate(__p, __deque_buf_size(sizeof(_Tp)));
}
_Tp** _M_allocate_map(size_t __n)
{ return _M_map_allocator.allocate(__n); }
void _M_deallocate_map(_Tp** __p, size_t __n)
{ _M_map_allocator.deallocate(__p, __n); }
_Tp** _M_map;
size_t _M_map_size;
in contrast to the 3.2 version (lines 385ff from stl_deque.h)
_Tp** _M_map;
size_t _M_map_size;
allocator_type _M_node_allocator;
_Map_allocator_type _M_map_allocator;
The code for the _Deque_alloc_base constructor is the same, though.
Hope this helps,
Peter Schmid