
7 Nov
2009
7 Nov
'09
7:49 a.m.
Gottlob Frege wrote:
2. What is left for reinterpret_cast to do? casting to/from ints to pointers, etc? (useful in lockfree programming, etc). Which would be better accomplished with unions I suppose.
Casting from pointer-to-function to pointer-to-object types (e.g., void*) is conditionally-supported for reinterpret_cast, and there's a guarantee that if both directions are supported, you can call through the pointer after casting it back to its original type. static_cast can't do this. (There's also the question of why you'd do this at all -- if you really need a typeless function pointer, you can cast to void(*)() with static_cast.) --Jeffrey