[PD-dev] I am really confused by this C problem - help?

federico mescalinum at gmail.com
Sun Sep 16 12:41:12 CEST 2007


float (t_float) and int (wich you specified with %d) have an
incompatible bit arrangement.

so it is wrong doing:

    t_float x = 8.0;
    post("%d", x);

you surely will get an inconsistent result.
better you do an explicit cast:

    post("%d", (int)x);

-- 
Federico

On 9/16/07, Ed Kelly <morph_2016 at yahoo.co.uk> wrote:
> Hi there,
>
> I just don't get this one. I have an object (maskxor) with a [mode $1 (
> method. I've attached an extra outlet to this object so I can see what its
> value is, and I have a post("mode = %d", x->mode); to display it in the PD
> window. The type of x->mode is t_float. Right, so when I change the mode
> from 0 to 1, I should see 1 on the mode outlet and "mode = 1" in the PD
> window, right? wrong. I get -1.463894 or something like that on the mode
> outlet, and -219478567583 or something in the PD window. Can someone
> pleeeeeease tell me what is going on?
>
> Patch code and pd_linux object enclosed.
> Best,
> Ed
>
>
> Lone Shark "Aviation" out now on
> http://www.pyramidtransmissions.com
> http://www.myspace.com/sharktracks
>
>  ________________________________
>  For ideas on reducing your carbon footprint visit Yahoo! For Good this
> month.
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev
>
>
>




More information about the Pd-dev mailing list