由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Does VC++ 6.0 not support dynamic cast?
相关主题
C++: static_cast and dynamic_castC语言重复定义问题
C++ cast 小结程序从VC6挪到VC2008后,执行速度低了15-30%
C++ 弱问一个windows 7 下的C 和shell 编程软件
问题师傅们都出来看看吧,我也问个C++返回值问题。
VC++ 中的 memory leak problem学习VC++求教
问一个有关iostream的问题一个诡异的const_cast问题
C++: operator new 为啥要是 static的, 不是有啥影响?师傅们,C++概念题,弟子有礼了
c++标准函数传递一问为什么大家都说c++水很深?
相关话题的讨论汇总
话题: c++话题: pet话题: cat话题: dynamic话题: cast
进入Programming版参与讨论
1 (共1页)
n**d
发帖数: 9764
1
How come this code crash in runtime by VC++ 6.0?
#include
using namespace std;
class Pet { public: virtual ~Pet(){}};
class Cat : public Pet {};
int main() {
Pet* b = new Cat; // Upcast
Cat* d = dynamic_cast(b);
}
h*******e
发帖数: 225
2
VC6 is buggy. Use something else.

【在 n**d 的大作中提到】
: How come this code crash in runtime by VC++ 6.0?
: #include
: using namespace std;
: class Pet { public: virtual ~Pet(){}};
: class Cat : public Pet {};
: int main() {
: Pet* b = new Cat; // Upcast
: Cat* d = dynamic_cast(b);
: }

n**d
发帖数: 9764
3
How could it be in the market if it has so obvious bug?!

【在 h*******e 的大作中提到】
: VC6 is buggy. Use something else.
s***e
发帖数: 122
4
You could turn on the RTTI (in Project->Setting->C/C++->C/C++ Language) to
avoid this. You should have noticed the warning C4541: 'dynamic_cast' used
on polymorphic type ...
Anyway, this should be part of the C++ language, not an option.

【在 n**d 的大作中提到】
: How could it be in the market if it has so obvious bug?!
d***q
发帖数: 1119
5
vc 6.0 only covers 80% std c++,don't expect you can use tricks with this
compiler
1 (共1页)
进入Programming版参与讨论
相关主题
为什么大家都说c++水很深?VC++ 中的 memory leak problem
Java10年前的崛起是技术到达一定成熟度的标志问一个有关iostream的问题
STL堆操作怎样对堆顶元素做ShiftDown?C++: operator new 为啥要是 static的, 不是有啥影响?
Delphi这个语言是不是已经死了?c++标准函数传递一问
C++: static_cast and dynamic_castC语言重复定义问题
C++ cast 小结程序从VC6挪到VC2008后,执行速度低了15-30%
C++ 弱问一个windows 7 下的C 和shell 编程软件
问题师傅们都出来看看吧,我也问个C++返回值问题。
相关话题的讨论汇总
话题: c++话题: pet话题: cat话题: dynamic话题: cast