|
From: | Bill Auerbach |
Subject: | [lwip-devel] Proposing change to netif state member |
Date: | Mon, 19 Mar 2012 13:32:43 -0400 |
It would be nice to override the void type in void *state in struct netif.h. This is the pointer to be used by the Ethernet hardware port or other user-code and it would be nice to use it with the correct type instead of casting whenever it’s used. Even currently where an assignment is made to a variable of the correct type, a cast isn’t required in C but it is in C++. I would like to use for example netif->state->somethingInMyPort;
I’m proposing something like this:
/** This field can be set by the device driver and could point
* to state information for the device. */
#ifdef NETIF_STATE_TYPE
NETIF_STATE_TYPE state;
#else
void *state;
#endif
And in cc.h I can use:
#define NETIF_STATE_TYPE struct myPortDescriptor *
Then all my uses of netif->state are of the correct type and I don’t need to cast it.
Bill
[Prev in Thread] | Current Thread | [Next in Thread] |