Reputation: 8633
SO, I have been asked to compile some legacy C code on a AIX7 (64 bit ) box.
And, I just changed the makefiles to edit the compiler that was used (from gcc to xlc_r), and the flags, from (-DAIX3 to -DAIX7).
However, thanks to this tomfoolery, I am getting an error which complains
xlc_r -c -q64 -O -DAIX -DAIX7 log.c
"log.c", line 128.7: 1506-343 (S) Redeclaration of log_write differs from previous declaration on line 140 of "lib.h".
"log.c", line 128.7: 1506-378 (I) Prototype for function log_write cannot contain "..." when mixed with a nonprototype declaration.
"log.c", line 165.7: 1506-343 (S) Redeclaration of log_errno differs from previous declaration on line 141 of "lib.h".
"log.c", line 165.7: 1506-378 (I) Prototype for function log_errno cannot contain "..." when mixed with a nonprototype declaration.
make: 1254-004 The error code from the last command is 1.
The method is question look like
extern void log_write _PROTO(( int, char *, ... ));
extern void log_errno _PROTO(( int, char *, ... ));
I want to know what the ... is, does it make for an open list of parameters? And how do I get this to run on AIX7?
Upvotes: 0
Views: 612
Reputation: 4610
An ellipsis (...) in a function declaration or definition indicates that the function accepts a variable number (zero or more) of parameters.
Back in the days when it was common to need to compile code using both pre-ANSI and ANSI-conforming compilers, a frequent approach for handling function declaration differences between the two flavors of the C language was to conditionally define a macro that could allow either ANSI-style declarations or K&R-style declarations by changing a macro definition. I suspect that the _PROTO() macro used in your example is being defined to have K&R-style declarations instead of ANSI-style declarations with prototypes, fixing this will likely address these compilation issues
Upvotes: 2