>  This is type-punning and not really a good idea.

No, it's not. It'd be type punning if it was a cast to anything but char*.