Can a function with variable no. of arguments be overloaded in VC++?
I have an exported function in a dll(written in vc++) which has got variable no. of arguments. Now I want to overload this function without variable no. of arguments. Is there anything wrong with this concept? The reason I am concerned is because I have read that vc++ uses __cdecl calling conve开发者_如何学Pythonntion for c and c++.
Sample signatures are given below.
void f(int i, char *fmt, ...);
void f(int i, string str);
It depends from where are you planning to call these functions.
They should be converted to names like f__FiPc??
and f__Fi6string
.
C++ compiler will decode them and C compiler will miss the function f
if you haven't declared extern "c"
. However it depends on the implementation of your compiler.
精彩评论