[PD-dev] Re: [PD] please test: threaded soundfiler & garray locks

Thomas Grill gr at grrrr.org
Thu Jun 17 20:10:56 CEST 2004

> > in g_array.c, line 928 the variable ret is defined after some
> > statements which is not conforming to standard c. My compiler hickups.
> hm ... both icc and gcc don't complain about this line ... i admit, i'm
> a bit confused ... what compiler are you using?

It's really not a problem, i would have checked in the version working for
all compilers if cvs was accessible.... please see the code below
In standard C (but maybe this is outdated) you have to declare all variables
before the forst statement in a function. gcc has some flags to enforce
strict syntax checking. I use MS Visual C .NET here.

best greetings,

    /* get any floating-point field of any element of an array */
float garray_get(t_garray *x, t_symbol *s, t_int indx)
#ifdef GARRAY_THREAD_LOCK /* TB: array lock */
    t_template *template = garray_template(x);
    int yonset, type;
    t_symbol *arraytype;
    float ret;
    if (!template_find_field(template, gensym("y"), &yonset,
     &type, &arraytype) || type != DT_FLOAT)
     error("%s: needs floating-point '%s' field", x->x_templatesym->s_name,
     return (0);
    if (indx < 0) indx = 0;
    else if (indx >= x->x_n) indx = x->x_n - 1;
    ret = (*(float *)((x->x_vec + sizeof(t_word) * indx) + yonset));
#ifdef GARRAY_THREAD_LOCK /* TB: array lock */
    return ret;

More information about the Pd-dev mailing list