OBJ-C: Multi-variable parameters

- (id) foo : (id) firstElement, ...
{
    // list place-holder
    va_list elements;
   
    id first = firstElement;
    id next;
   
    // where to start counting from
    va_start(elements, firstElement);

    do {
        // grab next id
        next = va_arg(elements, id);
        // do something with next
    } while (next != nil); 
   
     // end variable list
     va_end(elements);

     return nil;
}

No comments: