4 ms·
I've never heard of variadic functions not being declared cdecl (_cdecl, __cdecl, whatever). This is also the first time I've ever heard that "C requires that
by CamperBob 16y ago
I've never heard of variadic functions not being declared cdecl (_cdecl, __cdecl, whatever). This is also the first time I've ever heard that "C requires that code be able to call functions even if their prototype is not visible, which means the compiler doesn’t necessarily know if it’s calling a variadic function at any given call site." Can someone point to an authoritative reference for this?
On Win32 (and presumably most other systems as well) it's perfectly kosher to require variadic functions to be declared cdecl. This all sounds like a giant nonissue to me. Add support for cdecl functions and move on.
- caf 16y agoThe comment about C requiring functions to be able to be called without a prototype in scope is not true, in the case of variadic functions. Calling a variadic function without a correct prototype in scope is undefined behaviour - so it's open to an ABI to specify a different calling convention for them. (The relevant part of C99 is §6.5.2.2 Function Calls, p6).