Home

On 28 sep, 21:11, "Jim Langston" <tazmas...@rocketmail.com> wrote:
>
> It is the void* ExtraInfo I am trying to make a little more friendly. In the
> OnMessage I have to do things such as:
> int Amount = *reinterpret_cast<int*>( msg.ExtraInfo );
>
> Which, okay, usually, is okay. But, somewhere someone may have stuck an int
> in there instead of a float or such. Not very typesafe. And I don't like
> the reinterpret_cast.

Btw, with void* you dont have to use reinterpret_cast. void* can be
casted to any pointer and any pointer can be casted to void*, with
static_cast. It's not THAT bad, I'm still using this for old-school
callbacks ("userdata"). What is VERY bad is to reinterpret POD (with a
pointer and a size).
Though it doesn't solve your problem, sorry ^_^

previous
next

Re: A few questions on C++
Re: Pointer vs Reference
Re: access the name of my method inside it
Re: C++, BISON, and M4
Re: string or const char * in a function parameter list ?
Kidprotect
Podaruj Zycie
Rodzic Po Ludzku
Niechciane i Zapomniane
Krwinka