I've vastly simplified the struct definitions to minimise the size of the code, but the meaning is the same. The query is with the definition of SCIP_Reader.
Once the macro define has been applied, the line in SCIP_Reader becomes :
Code:
SCIP_RETCODE (*readerfree) (SCIP* scip, SCIP_READER* reader);
Although I understand the first half, I don't understand what the second half (the scip and reader declarations) means in this particular case, and when I try to compile, I get the error:
test.c:18: error: expected declaration specifiers or ‘...’ before ‘SCIP_READER’
The error makes sense, I guess, as as far as I know, you can only declare one variable per line, not three.
I am not trying to get the code to work, as that misses the point. I merely want to understand the above particular line.
Code:
#define SCIP_DECL_READERFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_READER* reader)
enum SCIP_Retcode
{
SCIP_OKAY = 1,
SCIP_ERROR = 0
};
typedef enum SCIP_Retcode SCIP_RETCODE;
struct Scip
{
int id;
};
typedef struct Scip SCIP;
struct SCIP_Reader
{
SCIP_DECL_READERFREE ((*readerfree));
// After applying the macro at line #1, the above line becomes
//SCIP_RETCODE (*readerfree) (SCIP* scip, SCIP_READER* reader);
};
typedef struct SCIP_Reader SCIP_READER;
int main(void)
{
return 0;
}