[PD-dev] anyone understand the t_symbol** type punning in expr?

Hans-Christoph Steiner hans at at.or.at
Thu Dec 13 04:36:29 CET 2012


In extra/expr~/vexp.c and extra/expr~/vexp_if.c there is this construct:

   char *tmp;
   tmp = eptr->ex_ptr;
   if (ex_getsym(tmp, (t_symbol **)&(eptr->ex_ptr))) {

The function there looks like a wrapper to gensym() more or less:

typedef t_symbol *fts_symbol_t;
int ex_getsym(char *p, fts_symbol_t *s)
{
        *s = gensym(p);
        return (0);
}

ex_ptr is defined as a char* in the ex_cont struct that eptr is.  This is the last type-punning in extra/  Anyone have any idea how to fix it so its not type-punning?  I can't even understand what the code is doing, it looks like its generating a symbol but then storing the t_symbol* in a char*, which is just strange.

.hc


More information about the Pd-dev mailing list