c++
baobaoyan
这个作者很懒,什么都没留下…
展开
-
vc6.0 连接错误
错误提示:nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadexnafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex解决方法:1、“Project”->“原创 2012-12-17 15:19:32 · 516 阅读 · 0 评论 -
c++类成员函数作为回调函数
我以前写线程时要么老老实实照着声明写,要么使用C++类的静态成员函数来作为回调函数,经常会因为线程代码而破坏封装.之前虽然知道类成员函数的展开形式,但从没想过利用过它,昨天看深入ATL时无意中学会了这一招:)类成员方法是一个比较特殊的函数,它在编译时会被转化成普通函数,比如有TMyClass类: class TMyClass{view sourceprint?转载 2014-05-15 16:06:38 · 894 阅读 · 0 评论 -
多线程 list没有锁好导致的 不安全宕机问题
问题:因为代码中执行m_LoggerList.size()语句没有加锁,导致内存中出现了空指针,以下为状态推送线程的堆栈信息:(gdb) thread 20[Switching to thread 20 (Thread 4884)]#0 std::_List_const_iterator::operator++() (this=0x20c6b498) at /opt/freew原创 2013-11-08 16:42:22 · 1525 阅读 · 0 评论 -
一个简单的读写同步的空间解决方法
struct TTest{ int iIndexType; char cDate[150]; void init(){ iIndexType=NO_DATE; memset(cDate,0,sizeof(cDate)); }; TEventPack(){ init(); };};class CTestManager{public:原创 2013-11-08 16:28:10 · 596 阅读 · 0 评论 -
stl学习--我的第一个容器
#include templatestruct myblock{ typedef T value_type; typedef value_type* pointer; typedef const value_type * const_pointer; typedef value_type & reference; typedef const value_type*原创 2013-11-08 15:15:06 · 555 阅读 · 0 评论 -
stl学习笔记1106
#include #include #include #include #include #include #include //#include using namespace std;typedef vector::iterator strtab_itorator;bool stringcmp(strtab_itorator astart,strtab原创 2013-11-06 17:15:17 · 460 阅读 · 0 评论 -
aix5.3移植到aix7.1
gcc安装 从IBM上下载RPM包(ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gcc/)gcc-4.2.0-3.aix6.1.ppc.rpm,gcc-cplusplus-4.2.0-3.aix6.1.ppc.rpm,libgcc-4.2.0-3.aix6.1.ppc.rpm,libstdc原创 2013-10-24 12:46:30 · 1092 阅读 · 0 评论 -
DEBUG map delete释放报错问题
如上文所述(MSDN): _CrtIsValidHeapPointer确认内存地址在本地堆。……如果静态链接C运行库,那么,dll拥有一个独立于应用程序(调用它的exe)的本地堆。(所以你上面的程序会Debug Assertion Failed),如果没有定义_DEBUG,那么_CrtIsValidHeapPointer将被预处理器移除。 所以方法有二: 1、动态链接C运行库。转载 2013-09-24 15:01:59 · 686 阅读 · 0 评论 -
vs 2008打断点失效
1.检查工程配置是否设置正确。C++>General->Debug Information Format->Program Database (/Zi)C++>Optimization->Optimization->Disabled (/Od)Linker->Debugging->Generate Debug Info->Yes (/DEBUG)Linker->Debuggin转载 2013-08-28 21:07:03 · 643 阅读 · 0 评论 -
C++指针直接调用类成员函数探讨
摘要 本文分析了C++编程中用指针调用“类” 成员函数时出现的问题、原因及后果,讨论了一般函数指针和“类”成员函数指针的不同。得出结论: 任何指向“类”的成员函数指针,由于携带额外的所属对象信息,与一般的函数有根本的不同,不能直接用来进行函数调用。此外,本文给出了几种间接调用类的成员函数的方法。本文所有代码在VC++6.0下编译通过。 要害词 C++编程; 类; 成员函数; 函数指针; 函数调用转载 2014-05-21 16:12:37 · 1124 阅读 · 0 评论