[PD-dev] t_sample vs t_float in PDa vs vanilla

Hans-Christoph Steiner hans at at.or.at
Fri Jan 1 23:54:11 CET 2010


On Jan 1, 2010, at 4:22 PM, IOhannes m zmölnig wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hans-Christoph Steiner wrote:
>>
>> This would obviously work better that my code, but I still don't  
>> see the
>> point of using a t_float there.  All three lines are casting t_ints  
>> from
>> w into values that then get added together to be a t_sample so why  
>> use
>> anything the middle?  On PDa that means casting a t_int to a t_float
>> then to an int (i.e. t_sample) for no reason.
>
> w[2] is t_int* to be something pointable.
> you cast it to t_float because the value really is a t_float.
> then you convert it to a t_sample, because this is what you need.
> on PDa it is the same;
>
>
> you can never get around these three casts, if you want it to work
> correctly.
> you can do "magic" if you believe that this will make the compiled  
> code
> faster (in most cases it won't) and you don't care for readability and
> maintainability.


Ok, that makes sense.  I'm curious why its not a t_sample* or void*  
instead of a t_int*.  That certainly makes things less readable.

.hc

----------------------------------------------------------------------------

                             kill your television






More information about the Pd-dev mailing list