This is the mail archive of the mailing list for the Archer 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]

"long" vs. "long int" (what a mess!)


Consider this source:

--- ---
#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
--- ---

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/", 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> > >> = 
       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?

Paul Pluzhnikov

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