The timer API: size or type safety?
Posted Dec 7, 2006 16:16 UTC (Thu) by pimlott
Parent article: The timer API: size or type safety?
Wow--what Al has done is write a type-safe parametrically polymorphic function in C! The signature of SETUP_TIMER is effectively
void SETUP_TIMER((*function)(T), T data)
where the T can be any (pointer) type. While you can't write such a signature in C, Al guarantees that the two instances of T are in fact the same with a clever bit of code that has no run-time impact. Lovely!
to post comments)