So here is the line of code that I was curious, rather concerned about.
#define PROCESS_NAME(name) extern struct process name
This line is from the source code of Contiki-OS(v2.4), an embedded operating system concentrating on networking etc. I am trying to port it for another platform. For that I must understand all of the code and what's happening in background.
The line of code given above intriugues me. The problem is, it is working, yet I cannot justify how. It is a macro, for declaring name of a process (which resides as a structure in RAM). However, which identifier in the expression is the structure? Is it process? Or name? Or both? Or none?
What on earth does struct process name mean? If it had been struct process, that would have been understandable. If it had been process name, it'd have been justified (considering process was declared as a structure or type earlier). But what do they mean, combined?
I tried to guess. The possibility that I can think of is, there is a structure called process and it has an instance called name... But that doesn't fall into the context.
I tried to guess. The possibility that I can think of is, there is a structure called process and it has an instance called name... But that doesn't fall into the context.
It is exactly that.
In C, the keyword "struct" is required in every variable declaration. C++ does not, so this may have you off balance here. This is why the Windows API defines all structs inside a typedef, so the keyword "struct" is not necessary even in C.