Is returning va_list safe in C?

c, c89, c99, variadic-functions

Solution

`va_list` might (but is not guaranteed to) be an array type, so you can't pass or return it by value. Code that looks as if it does, might just be passing/returning a pointer to the first element, so you can use the parameter in the callee but you might be acting on the original.

Formally you can probably say that `va_list` is an entity type, not a value type. You copy it with `va_copy`, not with assignment or via function parameters/return.

Problem

I'd like to write a function that has return type of va_list. example: `va_list MyFunc(va_list args);` is this safe and portable?

Original source

Related problems