Casting const char* to void*

H

Hakan

Is static_cast<void*>( const_cast<char*>( p )) the correct construction for
casting a const char* p to a void* p?

TIA.
 
R

Ron Natalie

Hakan said:
Is static_cast<void*>( const_cast<char*>( p )) the correct construction for
casting a const char* p to a void* p?
Actually, you don't need the static_cast in most cases. Once you cast away
the const, the implicit conversion to void* will work.
 
H

Hakan

Actually, you don't need the static_cast in most cases. Once you cast away
the const, the implicit conversion to void* will work.

Thank you, worked great.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top