Wednesday, July 1, 2015

Re: [Discuss-gnuradio] a two blocks synchronizing problem

Sorry, typo:

...
> then your arguments must have types but need to be identifiers and can be expressions that give you a value
...
is wrong,
needs to read
> can *not* be expressions that give you a value
Full text, corrected:

>> In another topic, you wrote me that was syntactically incorrect and you
>> advice me to set it like this:
>> set_output_multiple(tamano_entrada+nsimbolo);
>>
>> But this way I get the errors <'tamano_entrada' is not a type> and <expected
>> ',' or '...' before '+' token>
> Different things are correct to do different things: When you call a
> function, you must not say which types the parameters have.
> If you do something that your compiler thinks is a function declaration,
> you must.
>
>> Again, when I set this parameters the first time I asked (void
>> set_output_multiple (int tamano_entrada + nsimbolo);
>> void set_relative_rate (double relative_rate);) I did not get any errors,
> I'd like to address these two lines, and then remove myself from this
> discussion. You make C++ beginner's mistakes, which is totally ok, and
> can be overcome with a little training, but this is really not the place
> to discuss this, I'm afraid. I must apologize if I came across harsh at
> times, but you must understand that there's a gap between the level of
> questions you're asking and your ability to autonomously write correct
> C++ code, and I can't help you bridge that.
>
> void set_output_multiple (int tamano_entrada + nsimbolo);
>
> This doesn't really make sense. Either you're in a situation where you need to supply the type (you *declare* or *define* the function/method set_output_multiple), then your arguments must have types but need to be identifiers and can not be expressions that give you a value (such as tamano_entrada + nsimbolo).
>
> OR you're in a place to *use* that already existing function or method (that's the case here), and the typename is wrong.
> I can't find any way that GCC won't give an error for this line, sorry; I think you might be missing some compiler errors.
>
> void set_relative_rate (double relative_rate);
>
>
> That is **not** a call to gr::block::set_relative_rate. That is a function declaration, possibly hiding the original method. C++ in some compilers/versions supports local-scope function declarations like these. A call would simply look like
> set_relative_rate(12.12);
> or
> set_relative_rate(relative_rate);
> but can *never* declare the type of either the arguments or the return value of that function. That's logical, because the function must already be declared if you want to use it. The fact that this seems to work better than what I told you to do means that you have more mistakes that get hidden by this mistake.
>
> Best regards,
> Marcus


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment