List.h defines a macro called list_entry which is a wrapper for container_of() function. An elegant function, which seems very delicate:
Consider this piece of code:
tmp = list_entry(pos,(struct Order),ord_Queue);
When I compile it using gcc, a constant error of expected expression is popping up.
My structure is defined as:
struct Order
{
double idNum;
char* entryTime;
char* eventTime;
struct list_head ord_Queue;
};
It seems there is a problem with container_of when there are superfluous brackets used in Arg2 and Arg3, and there should be one bracket only for Arg1 courtesy here . I have tried it, but it doesnt work.
Some help would be appreciated.
Maybe there is an error in
list.h
when you copied it from the kernel? (Assuming you are doing a userspace program here.) Because your example code (stripped a little more) does compile with a known-good implementation.