Quick A: No reason, varargs are type-unsafe and entirely superseded by C++11 features (unless you need C compatibility).
Why use variadic arguments now when initializer lists are available?
I've been wondering what are the advantages of variadic arguments over initializer lists. Both offer the same ability -- to pass indefinite number of arguments to a function.
What I personally think is initializer lists are a little more elegant. Syntax is less awkward.
Also, it appears that initializer lists have significantly better performance as the number of arguments grows.
So what am I missing, besides the possibility to use use variadic arguments in C as well?
Add a Comment
Comments are closed.