std::deque 在Debug 与Release 下执行的不同
2016-04-20 16:32
453 查看
typedef struct _device_callstation_info { int nGuid; /*设备名字*/ char szName[JH_DEVICE_NAME_LEN+1]; std::deque<STRUCT_DEVICE_CALLSTATION_ZONE> * pDequeZone; _jinhong_device_callstation_info() { nGuid = 0; memset( szName, 0, sizeof(szName) ); pDequeZone = new std::deque<STRUCT_DEVICE_CALLSTATION_ZONE>; } _device_callstation_info & operator = ( _device_callstation_info & s ) { nGuid = s.nGuid; memset( szName, 0, sizeof(szName) ); strcpy( szName, s.szName ); pDequeZone->clear(); std::deque<STRUCT_DEVICE_CALLSTATION_ZONE>::iterator itZone; for ( itZone = s.pDequeZone->begin(); itZone != s.pDequeZone->end(); itZone++ ) { pDequeZone->push_back( *itZone );/*在此处Debug, Release 下不一样*/ } return *this; } ~_device_callstation_info() { nGuid = 0; memset( szName, 0, sizeof(szName) ); if ( pDequeZone && !pDequeZone->empty() ) { pDequeZone->clear(); delete pDequeZone; } } }STRUCT_DEVICE_CALLSTATION;
然后声明CArray<STRUCT_DEVICE_CALLSTATION,STRUCT_DEVICE_CALLSTATION&> arrCallstation;
STRUCT_DEVICE_CALLSTATION newCallstation;
. 设置值
arrCallstation.Add( newCallstation);
然后重开一个线程取值,也就是在newCallstation销毁后取值。
STRUCT_DEVICE_CALLSTATION newCallstation;
newCallstation = arrCallstation[0];
就在代码标识的地方(Release版本下)出现错误。
如上,声明为指针方式 ,在Debug与Release 下均正常。
std::deque<STRUCT_DEVICE_CALLSTATION_ZONE> * pDequeZone;
如果声明为一般变量,则在Debug下正常,而在Release下不正常。
std::deque<STRUCT_DEVICE_CALLSTATION_ZONE> dequeZone;
在代码的中的不正常的位置已经标识。*itZone,访问操作非法。难道在
相关文章推荐
- 神器SystemTap
- Python 七步捉虫法
- Lua编程示例(一):select、debug、可变参数、table操作、error
- C#中的两种debug方法介绍
- 用Ruby实现一个单元测试框架的教程
- js调试工具 Javascript Debug Toolkit 2.0.0版本发布
- php debug 安装技巧
- Oracle查询语句中rownum与rowid的不同之处分析
- Lua中的异常处理pcall、xpcall、debug使用实例
- 在Python编程过程中用单元测试法调试代码的介绍
- Android APK使用Debug签名重新打包 Eclipse更改默认Debug签名
- 如何使用lldb/gdb调试Nim程序
- Node.js 学习笔记之一
- Openstack Murano(Kilo) 网络排错
- 如何利用Object Browser图形化工具提高Oracle开发工作效率(二)对象创建管理篇
- 调试的艺术
- 在Eclipse里调试Vert.X
- node 调试
- 用Android Sutdio调试NDK