I came across the following function signature and I wondered if this (the ellipsis, or "..."
) is some kind of polymorphism?
#include <fcntl.h> int fcntl(int fd, int cmd, ... );
Thanks in advance.
va_list is like any other type. For example, the following code declares a list that can be used to store a variable number of arguments. 1. va_list a_list; va_start is a macro which accepts two arguments, a va_list and the name of the variable that directly precedes the ellipsis ("...").
ARGUMENT LIST. A list of cases put down for the argument of some point of law.
It means a reference to a pointer to an int. In other words, the function can change the parameter to point to something else.
printf is a "variadic" function. This means that the argument list is declared with ... on the end, and in the implementation of printf the va_list , va_start , va_arg etc macros are used to extract the arguments from the variable length list.
It's a variable argument list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With