Olin Lathrop embedinc.com> writes: >code for. So let's see a example unless you're willing to admit your > complaint is rubbish. this is not a p**ng contest, yet ... i am curious how Pascal handles the bad stuff: char messages[10]; char messages[0] = "AARGH";; char messages[1] = "RESULT:"; // etc char buffer[BUFFSZ]; void * va_func( void *arg0, ... ) { va_list vl; int ll = *(int*)arg0; char c; int t; void *p0 = NULL; va_start( vl, arg0 ); if(((c = *(char*)va_arg( vl, char* )) == 'x') || (c == 'y')) { p0 = buffer; if(ll < BUFFSZ) { while(--ll) *p0++ = *va_arg( vl, char* ); *p0 = '\0'; return( buffer ); } t = -1; ll = 1; } else { set t *(int*)va_arg( vl, int*); } if((t < 0) && (t > -10)) { strcpy( buffer, message[t*-1] ); while(--l) { strcat( buffer, (char*)va_arg( vl, char* ) ); } return( buffer ); } // insert code to return a struct here // ... return((struct funnystruct *)result); // insert code to return after recursing into va_func with ever // changing semantics and arity // insert code to interpret one of the arguments as a pointer to a // function sometimes, and call it with arguments if so return(NULL); } enum _MSG { MSG0 = -9, MSG1, MSG2, MSG3, MSGERR = -1, MSGSTART = -2 }; printf( va_func( 2, 'x', '0' ) ); printf( va_func( 3, MSG1, MSG2, MSG3 ) ); This code will not run without debugging, I typed it into a web mail interface by hand. Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist