Ah and I forgot to mention: Casting a pointer to a char* always works; that's something that C++ got from C; it's to ensure you can always get a byte-granular pointer; here I go actually citing stackoverflow :( :

http://stackoverflow.com/a/13996008

Greetings,
Marcus


On 21.07.2015 01:35, Richard Bell wrote:
So, the first line of work and general_work functions is usually something of the form

const unsigned char *in = (const unsigned char *) input_items[0];
unsigned char *out = (unsigned char *) output_items[0];

or

gr_complex *in = (gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];

or other input/output types.

The confusion comes when I make blocks that have user selectable types through GRC. I see from built-ins that developers use the unsigned char pointers for this usually. What I can't figure out is how this works when a user selects gr_complex as an input/output type. It seems to me that these pointers to unsigned chars should fail dramatically. But they don't! In fact, I can use either of the two forms I presented above and my flow graph "works", quotes because there maybe a fail case I haven't found yet, so far they just work either way.

Rich


_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to