vala Functions Variable arguments


Example

int sum (int x, ...) {
    int result = x;
    va_list list = va_list ();
    for (int? y = list.arg<int?> (); y != null; y = list.arg<int?> ()) {
        result += y;
    }
    return result;
}

int a = sum (1, 2, 3, 36);

With this function, you can pass as many int as you want. If you pass something else, you'll either get an unexpected value or a segmentation fault.