Variable Argument List: Go v.s. C/C++

Function Declaration
Both Go and C/C++ supports defining functions with variable argument list. A C/C++ example as follows:

void PrintSomething(const char* fmt, ...)

and a Go example:

func PrintSomething(things...interface{}) {}

A commonality between Go’s syntax and C/C++’s is the ... must be the last argument in the list. But a difference here is that, in C/C++, there is no way to constrain the type of arguments in the list, but in Go, we can define

func PrintSomething( {}

to constrain that all elements in things are integers.

Function Definition
In Go, the variable argument list has a name, e.g., things in above example, and the name indicates an array, whose elements can be accessed in the usual way we treat an array. For example:

func PrintSomething(things...interface{}) {
	for _, v := range things {
		fmt.Printf("%v\n", v)

In C/C++, we have no clue with the type of each element in the variable argument list, and, we do not even know how many arguments are there in the list. So, we must have a meta-info about the list. An example is the first argument, const char* fmt in above example. Given fmt denote the length of the list and types of list elements, we can use facilities including va_list, va_start, va_arg, and va_end to enumerate elements in the list, and process each element according to its type. An example can be found here.