Closed elliotwoods closed 8 years ago
This is not possible in C. vararg functions do not know how many arguments they were passed, so there must be a sentinel value which designates the end of a list.
Yep, @Dr-Emann is right.
On GCC we do use the sentinel attribute to indicate that a NULL
is required, but I'm not aware of any equivalent for MSVC. If anyone is aware of something I'm willing to add it.
FWIW, the sentinel attribute will work on clang and ICC, too. Basically everywhere except MSVC.
currently it can cause an access violation if you call function:
rather than
this is due to the empty arguments being interpreted as options, which are then processed and then we have a crash (in MSVC, i get an access violation on Debug but on Release it 'just works').