in reply to double array in XS

Here's my actual working XSUB btw:
void something(input, ...) CODE: double *input = (double *) alloca((sizeof(double)) * (items-1) +); for(int i=0; i<(items-1); i++) input[i] = (double) SvNV(ST(i+1)); THIS->something(input);

Replies are listed 'Best First'.
(tye)Re2: double array in XS
by tye (Sage) on Nov 02, 2000 at 21:43 UTC

    Note that alloca() is not as portable as one might hope. I find it very useful in XS code, but avoid it (now) because it would make my modules less portable. ):

    I try to replace it with creating SVs with PV buffers of the proper size and letting Perl's garbage collection free the buffers for me.

            - tye (but my friends call me "Tye")