>> and parsing gets abit more messy...
>How ?
[...]

This is how it looks now, better than using va_arg() at each case imho...


void lame_set_int(lame_global_flags *gfp, lame_param_tag tag1, ...)
{
   va_list ap;
   int param;   /* (varargs promotes integrals to int) */

   va_start(ap, tag1);
   while (tag1 != TAG_END)
   {
     param = va_arg(ap, int);

     switch (tag1)
     {
       case LAMEtag1:
         gfp->test1 = param;
         break;

       case LAMEtag2:
         gfp->test2 = param;
         break;

       default:
         break;
     }

     tag1 = va_arg(ap, lame_param_tag);
   }
   va_end(ap);
}


I can still implement a way to have the tag also contain the type of the
parameter, but since the general consensus seemed to be that this would be
too complicated I went for this approach... ;)


- CISC

--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to