Hi Rich,
you've got that right – PMT pretty much enforces a paradigm of
returning new objects when you need a modified version of
something.
Is there a right way to do this that doesn't require a left-hand
side assignment?
No, your understanding is right, the documentation is wrong :)
Best regards,
Marcus
On 12/12/2016 07:30 PM, Collins,
Richard wrote:
Hello,
Something that has tripped me up a couple times when
messing around with PMTs is I forget that there's a
left-hand argument to pmt::dict_add (especially
since the first argument is the pmt dictionary I
want to update). Being a little new to this still,
it took me a little while to figure out what the
problem was.
on http://gnuradio.org/doc/doxygen/page_uhd.html#uhd_command_syntax
there is the following example:
pmt::pmt_t command =
pmt::make_dict();
pmt::dict_add(command, pmt::mp("freq"),
pmt::mp(1.1e9)); // Specify frequency
pmt::dict_add(command, pmt::mp("chan"), pmt::mp(1));
// Specify channel
but, I believe it should be like this instead (unless
I've just been doing something wrong):
pmt::pmt_t command =
pmt::make_dict();
command = pmt::dict_add(command, pmt::mp("freq"),
pmt::mp(1.1e9)); // Specify frequency
command = pmt::dict_add(command, pmt::mp("chan"),
pmt::mp(1)); // Specify channel
Again, I could be totally wrong, but it's my experience
that pmt::dict_add only returns a new dictionary as a
return value, and not to the (address of?) the dictionary
that was passed in.
Is there a right way to do this that doesn't require a
left-hand side assignment? Should I instead be passing the
address of the dictionary, or something? Again, total newb.
Thanks,
Rich
_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
|