On Thu, May 25, 2017 at 03:52:47PM +0100, Jonathan Wakely wrote: > I'd probably write that like this instead: > > void > foo (const void *p) > { > typedef const int* ptr_type; > ptr_type const q = (ptr_type) p; > ptr_type const r = (ptr_type) p; > (void) q; > (void) r; > } > > It names the type only once, not twice as in your example, and doesn't > need to use typeof to refer to that type again.
That was over-simplified, I meant cases where you actually don't know the exact type, just use typeof to create a variable of such a type and then want to cast something to that type. Jakub