- Codice: Seleziona tutto
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
Cosa significa __mptr?
Moderatore: Staff
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})

#define PIPPO_INTERO 1
//una struttura inutile :-)
typedef struct _a_useless_struct {
#ifdef PIPPO_INTERO
int *puntatore_a_una_variabile_inutile;
#else
double *puntatore_a_una_variabile_inutile;
#endif
} a_useless_struct;
//punto alla variabile della struttura fregandomene del define
a_useless_struct pandora;
const typeof(pandora.puntatore_a_una_variabile_inutile) puntatore_costante_taldeitali;


#warning "don't include kernel headers in userspace"


afterjames ha scritto:
- Codice: Seleziona tutto
#warning "don't include kernel headers in userspace"

Visitano il forum: Nessuno e 1 ospite