[PD] readanysf~ almost beta

Mathieu Bouchard matju at sympatico.ca
Mon Apr 14 20:52:40 CEST 2003


On Mon, 14 Apr 2003, august wrote:

> >    float buf[n*2]; // always multiply by the number of audio signal outlets
> > n is not constant since it's a function argument, and you try to reserve an
> > array of float with that.
> > Amazing that your compiler digests that (mine doesn't) ... it's definitely
> > not C++ as i know it.
> im not sure, but i think it treats the float[] kindof like a new() call.

This is a GCC-specific extension to C/C++; it's a shortcut for alloca(),
which does its allocation on the stack, while new and malloc() do their
allocation on the heap; alloca() blocks disappear automatically upon
returning from a function. new/malloc() blocks need to be deallocated.

What compiler are you using?

(note: I'm using quite a bit of GCC-specific features in my code, which is
usually OK on Linux and MacOSX and Cygwin, but not good elsewhere)

________________________________________________________________
Mathieu Bouchard                       http://artengine.ca/matju





More information about the Pd-list mailing list