discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] PMT Pairs/Dictionaries type checking bug


From: Jacob Gilbert
Subject: [Discuss-gnuradio] PMT Pairs/Dictionaries type checking bug
Date: Thu, 10 Mar 2016 09:26:59 -0700

It appears that PMT dictionaries and pairs are treated identically when it comes to using the pmt::is_<type>() checking functions.

Example:

      pmt::pmt_t test_pair = pmt::cons(pmt::mp("pair"), pmt::mp(1));
      pmt::pmt_t test_dict = pmt::dict_add(pmt::make_dict(), pmt::mp("dict"), pmt::mp(1));

      if (pmt::is_pair(test_pair)) std::cout << "Pair is a pair" << std::endl;
      if (pmt::is_pair(test_dict)) std::cout << "Dict is a pair" << std::endl;
      if (pmt::is_dict(test_pair)) std::cout << "Pair is a dict" << std::endl;
      if (pmt::is_dict(test_dict)) std::cout << "Dict is a dict" << std::endl;

output is:

Pair is a pair
Dict is a pair
Pair is a dict
Dict is a dict

Naturally this causes issues if you attempt to use these PMTs (eg: get the keys from a pair). I'm not sure if this is an issue with GNU Radio or with some external PMT handling library, but at a minimum it seems like the doxygen (http://gnuradio.org/doc/doxygen/namespacepmt.html#a936ecb38da9a2a1bb107c090e194700f

"PMT_API bool pmt::is_pair (const pmt_t &obj)   Return true if obj is a pair, else false." 

should be updated to reflect this issue for both pmt::is_pair() and pmt::is_dict().

Jacob

reply via email to

[Prev in Thread] Current Thread [Next in Thread]