VC6 VS2003转换到VS2005中的一些问题

1. lifescope of int i in for(int i; i< size; ++i)

in VC6, the codes below are ok
for(int i = 0; i< 10; ++i)
{
//...
}
for(i = 20; i< 40;++i)
{
//...
}

but in VS2005, we should write like below:
for(int i = 0; i< 10; ++i)
{
//...
}
for(int i = 20; i< 40;++i)
{
//...
}
in fact, from vs.net, the compiler accord with C++ standard more than VC6.
If you are porting a VC6 project to VS2005, you will encounter many many codes like this.
 

2. ON_WM_NCHITTEST (and other MFC macros) won't compile in VS2005
VS2005中,ON_WM_NCHITTEST宏编译不过

When I add a message handler of ON_WM_NCHITTEST to a CControlbar-derived class, it compiles error:
error C2440: 'static_cast' : cannot convert from 'UINT (__thiscall CMenuBar::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)' Cast from base to derived requires dynamic_cast or static_cast

To fix this bug, we should change the prototype of OnNcHitTest
from
afx_msg UINT OnNcHitTest(CPoint point);
to
afx_msg LRESULT OnNcHitTest(CPoint point);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值