Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Is dynamic_cast' ing a NULL pointer safe

Thread Tools

Is dynamic_cast' ing a NULL pointer safe

Posts: n/a
Hi All,

Is the following statement safe when ptr1 value is NULL

Derived *ptr2 = dynamic_cast<Derived *>(ptr1)

though it works properly in VC++ yet I wanted to know if it is
considered safe as per the c++ standard (like delete NULL

Thanks in advance

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
pointer to pointer intialize to NULL but still point to NULL Christopher C++ 4 07-09-2011 12:35 AM
Null pointer (NULL array pointer is passed) aneuryzma C++ 3 06-16-2008 05:48 AM
"stringObj == null" vs "stringObj.equals(null)", for null check?? Java 5 03-29-2006 10:37 PM
safe to delete null pointer? Songling C++ 3 12-03-2004 10:23 PM
NULL macro vs. 0 as null pointer? Ken C++ 69 07-31-2004 04:45 AM