# Re: Should return the number of input or the number of output?

**URL:** <https://www.ruby-forum.com/t/re-should-return-the-number-of-input-or-the-number-of-output/240868>\
**Category:** GNU Radio\
**Created:** [May 4, 2014, 3:51am UTC](https://www.ruby-forum.com/t/re-should-return-the-number-of-input-or-the-number-of-output/240868 "2014-05-04T03:51:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 4, 2014, 3:51am UTC](https://www.ruby-forum.com/t/re-should-return-the-number-of-input-or-the-number-of-output/240868/1 "2014-05-04T03:51:19Z")

</div>

Part of this question has been partially discussed, as below.

On Mon, Mar 10, 2014 at 9:18 PM, Martin B.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> OK, I admit I was unclear. Let’s try from scratch:
> 
> - The return function from work() or general\_work() is the amount of  
> items that were _produced_.

Says, now I need to create a sink block, and I need to highly customize  
its  
built-in forecast() function.  
Hence I have two choices:-  
(i). Create this as a sink block, then explicitly overwrite its  
forecast()  
function in the body of the custom block.  
(ii). Create this as a general block.

Question 1: Will option (i) above work?

Question 2: If a sink block is implemented as a general block, does it  
still need to return noutput\_items, or just return 0, or doesn’t matter  
at  
all ? (I guess it should return 0 because the sink block doesn’t  
produce  
any output)

---

<div class="post-metadata">

**Author:** ![activecat\_k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@activecat\_k](https://www.ruby-forum.com/u/activecat_k)\
**Post date:** [May 4, 2014, 10:40am UTC](https://www.ruby-forum.com/t/re-should-return-the-number-of-input-or-the-number-of-output/240868/2 "2014-05-04T10:40:16Z")

</div>

Hi Activecat,

it’s a sink. As Martin said, keep it a sync block. Overriding forecast  
doesn’t even make sense; why should the scheduler ask the block “I’d  
like  
to have 2000 output items from you, how much input do you need” if it’s  
guaranteed to never produce output.

Maybe I’m getting something wrong, so why would you want to costumize  
the  
forecast function?

Greetings,  
Marcus
