Avatar of aerowang

asked on 

Question on definition of Variant Length Argument List

Hi,experts here.
I have found a typical definition of variant length argument list here:

typedef char* va_list;
#define va_start(list) list = (char*)&va_alist
#define va_end(list)
#define va_arg(list, mode)
((mode*) (list += sizeof(mode)))[-1]

(1)First,I'm not quite clear about "(char*)&va_alist" here.Is "list = (char*)&va_alist" equals to "list = va_alist",or Could it be written as "#define va_start(list) list = va_alist"?
(2)Second,Why is "typedef char* va_list" but not "typedef void* va_list" or even "typedef int* va_list",
What's its specialities?
Wish your help and
Thanks for any hint here.

Avatar of undefined
Last Comment

8/22/2022 - Mon