In case of using variable arguments in cpp, what does va_arg return as the next value in case there is no next value?
Also, can this be considered as a solution for counting the elements in va_list?
In case of using variable arguments in cpp, what does va_arg return as the next value in case there is no next value?
Also, can this be considered as a solution for counting the elements in va_list?
Copyright © 2021 Jogjafile Inc.
It's Undefined Behavior to do this, so you can't say anything about it. It's certainly unsuitable for counting.
Use variadic templates instead, those allow you to count arguments.