Type mismatch does not throw any error

Hi Everyone,

I was working with a small flow graph in GRC.

Random source(int output) ------> WXGUI Scope Sink(float input).

I was expecting it to throw an error because of type mismatch. But it
didn’t throw any error,
the scope popped up, but there were nothing in the plot.

Is it supposed to through an error, or is it a bug?

On Mon, Apr 15, 2013 at 2:26 AM, Manu T S [email protected] wrote:

Is it supposed to through an error, or is it a bug?

Manu T S


That’s not a bug, just a slightly different way of looking at things.
We don’t actually do type checking between blocks. We just make sure
that the item size of both output and input ports on a connection are
the same. So since sizeof(int) == sizeof(float) (for most machines
these days), that connection is actually ok.

It comes down to how the data in the buffers is handled. If one block
writes N items to the output buffer and another block wants to read in
N items, if the blocks think that the itemsize is different, the
number of bytes written and read will be different. That will affect
where the read and/or write pointers are relative to each other,
possibly causing you to read or write to non-safe parts of the buffer.

So we let you do things like this because we are only worried about
the current state of the buffers and the pointers, not the actual
underlying data.