This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
"long" vs. "long int" (what a mess!)
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: archer at sourceware dot org
- Cc: ppluzhnikov at google dot com
- Date: Thu, 6 Nov 2008 18:55:07 -0800 (PST)
- Subject: "long" vs. "long int" (what a mess!)
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1226026510; bh=EmMGVuPDVStCurNTVMW+h54jOgc=;h=DomainKey-Signature:To:Cc:Subject:Message-Id:Date:From; b=QvTbxbvLtl6wPMHvI+QYnZI6fqdj1TKO2tIOE/9XylCcRdQiZlVZ6/Ux3fVgfrmqWUtO1z1/+2sdjjFVZ8ueYw==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=to:cc:subject:message-id:date:from;b=Cqg4i4yhP4w9A+Al+fqRwXEuel6FQlThIVoNrQo9Z6PMx+c67x0YGRH74mjeFPCEQclP1svqZ7pxHokYv9QgNg==
Greeting,
Consider this source:
--- map.cc ---
#include <map>
using namespace std;
int main()
{
map<char, int> map_char_int;
map<unsigned char, int> map_uchar_int;
map<int, int> map_int_int;
map<unsigned, int> map_uint_int;
map<long, int> map_long_int;
map<unsigned long, int> map_ulong_int;
map<long long, int> map_longlong_int;
map<unsigned long long, int> map_ulonglong_int;
return 0; // break here
}
--- map.cc ---
Using Tom's latest StdMapPrinter, and ussuing 'info locals', I see
(gdb) inf locals
map_char_int = std::map with 0 elements
map_uchar_int = std::map with 0 elements
map_int_int = std::map with 0 elements
map_uint_int = std::map with 0 elements
Good so far... But:
map_long_int = Traceback (most recent call last):
File "<string>", line 13, in _format_children
File "/home/ppluzhnikov/.gdbinit.py", line 161, in children
nodetype = gdb.Type('std::_Rb_tree_node< std::pair< const %s, %s > >' % (keytype, valuetype))
RuntimeError: no such type named std::_Rb_tree_node< std::pair< const long, int > >
That's because the type is actually
std::_Rb_tree_node<std::pair<const long int, int> >:
{_M_t = {_M_impl =
{<std::allocator<std::_Rb_tree_node<std::pair<const long int, int> > >> =
{<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const
long int, int> > >> = {<No data fields>}, <No data fields>},
_M_key_compare = {<std::binary_function<long int, long int, bool>> =
{<No data fields>}, <No data fields>}, _M_header =
{_M_color = std::_S_red, _M_parent = 0x0,
_M_left = 0x7fffffffe548, _M_right = 0x7fffffffe548}, _M_node_count = 0}}}
All the rest of them cause similar trouble: either they need a trailing 'int',
or 'unsigned' is in the wrong place, or both :-(
Any suggestions on how to handle this mess?
Thanks,
--
Paul Pluzhnikov