|
From: | Jacob Gilbert |
Subject: | Re: [Discuss-gnuradio] PMT Pairs/Dictionaries type checking bug |
Date: | Thu, 10 Mar 2016 19:59:30 -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 pairDict is a pairPair is a dictDict is a dictNaturally 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
[Prev in Thread] | Current Thread | [Next in Thread] |