Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is this usage of definition correct?

26 views
Skip to first unread message

fl

unread,
Oct 15, 2017, 5:05:02 PM10/15/17
to
Hi,

I read the below code snippet on-line:






''''''''''''''''''''
#include <gr_sync_block.h>
class my_block_cc;
typedef boost::shared_ptr<6829_my_block_cc> 6829_my_block_cc_sptr;
6829_my_block_cc_sptr 6829_make_my_block_cc();
class my_block_cc : public gr_sync_block
{
private:
unsigned int d_count;
friend 6829_my_block_cc_sptr 6829_make_my_block_cc();
6829_my_block_cc();
public:
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
////////////////

It is found line 3 has below in the container(Is this correctly called?):
"6829_my_block_cc"

But I see this private function is declared in the last line of the private
section. This puzzles me a lot, as I think it should like the second line
to declare "my_block_cc" first, then it is defined.

Could you help me on it?


Regards,

Kalle Olavi Niemitalo

unread,
Oct 16, 2017, 1:44:54 PM10/16/17
to
fl <rxj...@gmail.com> writes:

> I read the below code snippet on-line:
>
> ''''''''''''''''''''
> #include <gr_sync_block.h>
> class my_block_cc;
> typedef boost::shared_ptr<6829_my_block_cc> 6829_my_block_cc_sptr;
> 6829_my_block_cc_sptr 6829_make_my_block_cc();

That seems corrupt; C++ does not support identifiers that start
with digits, like 6829_my_block_cc.
If you remove each "6829_", then it looks more sensible,
and the function you asked about becomes a constructor.

http://zoo.cs.yale.edu/classes/cs434/cs434-2012-fall/lectures/backup/6-gnuradio-jh.ppt
page 25 contains similar code, except it uses "cs434_" instead of "6829_".
That code doesn't work either.
0 new messages