typecheck code

From: Sri Ram Vemulpali
Date: Mon Jan 31 2011 - 12:03:41 EST


Hi all,

/*
* Check at compile time that something is of a particular type.
* Always evaluates to 1 so you may use it easily in comparisons.
*/
#define typecheck(type,x) \
({ type __dummy; \
typeof(x) __dummy2; \
(void)(&__dummy == &__dummy2); \
1; \
})

#define typecheck_fn(type,function) \
({ typeof(type) __tmp = function; \
(void)__tmp; \
})

Can anyone help me, explain the above code typecheck. How does
(void)(&__dummy == &__dummy2) evaluates to 1

I appreciate any explain.

--
Regards,
Sri.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/