0

I am unit testing a function which has arguments like;

extern int32_t
fabl_fmtstr_fprint (FILE *op UNUSED, const char *format, ...){}

I am not sure what the argument "..." is for. I am getting compile time error for it.

error: declaration of C function 'int32_t fabl_fmtstr_fprint(FILE*, const char*, int)' 
conflicts with
previous declaration 'int32_t fabl_fmtstr_fprint(FILE*, const char*, ...)' here

Could anybody explain me the reason? And I am using CppUTest(C++) for unittesting.

I have declared the funtion being FAKE as,

FAKE_VALUE_FUNC(int32_t, fabl_fmtstr_fprint, FILE* ,const char *, int);

In this case its asking for the missing "..." argument.

Shandeep Murugasamy
  • 311
  • 2
  • 3
  • 15
  • The error message says that you have provided two different declarations for this function. Decide which one is wrong and fix it. (Possibly one is an implicit declaration, if you called the function before having its prototype in scope, but that should also have given a warning or an error) – M.M Mar 02 '15 at 22:16
  • @MattMcNabb: An implicit declaration would not have a return type of `int32_t`. – Keith Thompson Mar 02 '15 at 22:17
  • @KeithThompson the standard doesn't require diagnostics to make sense ;) But you're probably right and there is actually a bogus prototype. – M.M Mar 02 '15 at 22:18
  • possible duplicate of [What does ... mean in an argument list in C?](http://stackoverflow.com/questions/1124265/what-does-mean-in-an-argument-list-in-c) – Barmar Mar 02 '15 at 22:18
  • Is your question about what's causing the error or what the `...` means? – Barmar Mar 02 '15 at 22:20
  • Is this C or C++? The question says C++, but you tagged it C. – Barmar Mar 02 '15 at 22:30
  • https://meekrosoft.wordpress.com/2012/06/05/fake-function-framework-request-for-comments/ - see the comments section. – Karoly Horvath Mar 02 '15 at 22:48

0 Answers0