|
-
October 28th, 1999, 06:22 PM
#1
casting
In the past year or so, I've seen casting like:
CObj* x = static_cast<CObj*> (y);
Is there any advantages of using static_cast instead of the good old casting like:
CObj* x = (CObj*)y
-= hm... =-
Grace
-
October 28th, 1999, 09:01 PM
#2
Re: casting
Short answer:
A static_cast is stricter about the conversions it allows.
For example: unlike the old C/C++ style cast (your example 2), it won't convert function pointers unless it can convert all the arguments and return types.
However, that static_cast does not perform a run-time check.
I don't do it for ratings, but appreciation is always in style.
Good luck in your journey in a C++ land.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|