
C++
chaosllgao
这个作者很懒,什么都没留下…
展开
-
各类收藏(文章、博客、软件)
【编程随想】的技术博客http://blog.youkuaiyun.com/program_think/https://code.google.com/p/program-think/ http://program-think.spaces.live.com/mmm2009-09-01_09.47/blog/cns!F5B0090663FEEADA!144.entryhttp://docs原创 2010-05-31 13:10:00 · 2138 阅读 · 0 评论 -
Inline Virtual Functions
From: http://msdn.microsoft.com/zh-cn/magazine/cc301407(en-us).aspxQHow does C++ handle inline virtual functions? When a function is inline and virtual, will code substitution take转载 2012-08-10 16:45:18 · 554 阅读 · 0 评论 -
找出数组中两个只出现一次的数字
From: http://blog.youkuaiyun.com/hackbuteer1/article/details/68892176、有N+2个数,N个数出现了偶数次,2个数出现了奇数次(这两个数不相等),问用O(1)的空间复杂度,找出这两个数,不需要知道具体位置,只需要知道这两个值。 求解:如果只有一个数出现过奇数次,这个就比较好求解了,直接将数组中的元素进行异或,异或的结果就转载 2012-08-09 15:58:16 · 861 阅读 · 0 评论 -
Extract the bitmap image data from the bitmap
From: http://win32-framework.sourceforge.net/Tutorials/tutorial9.htmIn order to use StretchDIBits we first need the bitmap image data. This is retrieved by using the GetDIBits. It is called tw转载 2012-06-27 16:55:50 · 406 阅读 · 0 评论 -
Capturing an Image from a window
From: http://msdn.microsoft.com/en-us/library/dd183402%28v=VS.85%29.aspxhttp://stackoverflow.com/questions/3688409/getdibits-and-loop-through-pixels-using-x-y// THIS CODE AND INFORMATION IS PR转载 2012-06-27 16:47:52 · 502 阅读 · 0 评论 -
Top-Down vs. Bottom-Up DIBs
From: http://msdn.microsoft.com/en-us/library/windows/desktop/dd407212(v=vs.85).aspxIf you are new to graphics programming, you might expect that a bitmap would be arranged in memory so that转载 2012-07-05 10:14:55 · 591 阅读 · 0 评论 -
Using C/C++ libraries with Automake and Autoconf
From: http://www.openismus.com/documents/linux/using_libraries/using_librariesUsing C/C++ libraries with Automake and AutoconfContentsIntroductionCFLAGS and LIBSconfigure.ac转载 2012-05-14 15:55:23 · 688 阅读 · 0 评论 -
Using Automake and Autoconf with C++
From: http://www.openismus.com/documents/linux/automake/automakeUsing Automake and Autoconf with C++ContentsIntroductionmake and configureautomake and autoconfSubdire转载 2012-05-14 15:26:26 · 760 阅读 · 0 评论 -
Building C/C++ libraries with Automake and Autoconf
From: http://www.openismus.com/documents/linux/building_libraries/building_librariesBuilding C/C++ libraries with Automake and AutoconfContentsIntroductionlibtoolDirectory st转载 2012-05-14 15:56:04 · 908 阅读 · 1 评论 -
一个 autoconf / automake 例子 --- 静态库、动态库 多源文件
From: http://hi.baidu.com/fambalaya/blog/item/8347f1b4a784627b8bd4b2d4.html###这是一个 autoconf / automake 的 "Hello World"gztt.ll@gmail.com主要步骤是- 准备工程目录结构和程序- autoscan 生成 configure.sca转载 2012-05-11 14:55:20 · 672 阅读 · 0 评论 -
如何修改Windows系统环境变量
Referred:http://msdn.microsoft.com/en-us/library/windows/desktop/ms682653(v=vs.85).aspxhttp://support.microsoft.com/kb/104011/en-ushttp://blog.youkuaiyun.com/Jans/article/details/800663Calli原创 2012-05-09 13:31:14 · 1274 阅读 · 0 评论 -
A beginner's guide to writing a custom stream buffer (std::streambuf)
From: http://www.mr-edd.co.uk/blog/beginners_guide_streambufA beginner's guide to writing a custom stream buffer (std::streambuf)Streams are one of the major abstractions provided转载 2012-05-06 22:04:14 · 1991 阅读 · 0 评论 -
命令行参数解析之GetOpt
Reference: http://www.urbanophile.com/~arenn/hacking/download.htmlgetopt的详细使用在这份gnu java port的实现中做了非常翔实的描述,超越原著。特此增加批注以供查阅。虽然这是java的一个port版,但是它与glibc的实现是100%兼容的(经过测试,确实如此),所以仍然可以作为C版本的参考。Mav原创 2012-03-03 18:59:06 · 1384 阅读 · 0 评论 -
STL list 排序
From: http://hi.baidu.com/chencqwu/blog/item/c594161dd084728687d6b6b1.html1.algorithm 里的sort()只接收RandomAccessIterator用于像vector,dequeue的排序2.像set,map,这种关联式容器,本身就由RBTree维护了有序,只要遍历一遍就行了。3.而l转载 2011-12-16 13:54:53 · 628 阅读 · 0 评论 -
C/C++运算符优先级表 - C Operator Precedence Table
From: http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm difranco.netC Operator Precedence TableThis page lists C operators in order of precedence (highest to lowest).转载 2012-08-11 08:31:19 · 1323 阅读 · 0 评论 -
Gaplessly playing large audio file with MS wave I/O functions
From: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4422&lngWId=3Windows waveOut Tutorial This tutorial is designed to help you use the windows waveOut interfacef转载 2012-07-27 17:23:30 · 1372 阅读 · 0 评论 -
O(n) 求 最长回文子串
From: http://bbs.dlut.edu.cn/bbstcon.php?board=Competition&gid=23474From: http://www.felix021.com/blog/read.php?2040如何在O(n)时间内处理字符串以每个位置为中心的最长回文。这里转载一个Manacher算法的论文翻译。原文地址:http://zhuhongch转载 2013-02-25 17:15:38 · 666 阅读 · 0 评论 -
C语言名题精选百则——排列,组合与集合
From: http://dsqiu.iteye.com/blog/1715253本篇博文,D.S.Qiu将对《C语言名题精选百则——排列,组合和集合》进行整理推出,不光只是书上的名题,还会依据互联网的资源进行不断补充,加强。等全书各个章节都整理完,会做一个总汇。如果你有建议、批评或补充,请你不吝提出(email:gd.s.qiu@gmail.com,或者直接在本文末评论)。你转载 2013-02-24 18:34:00 · 1389 阅读 · 0 评论 -
Linus Torvalds - 从单链表中删除节点
From: http://www.youkuaiyun.com/article/2013-01-10/2813559-two-star-programmingFrom: http://wordaligned.org/articles/two-star-programming几周前, Linus Torvalds在Slashdot上回答了一些问题。其中有一条引发了开发者们的强烈关注,当被转载 2013-01-15 10:20:27 · 1750 阅读 · 0 评论 -
MPlayer 源码阅读笔记
1. m_property.c val = calloc(1,opt->type->size); if((r = m_option_parse(opt,opt->name,arg,val,M_CONFIG_FILE)) free(val); return r; } r =原创 2012-12-19 21:59:55 · 498 阅读 · 0 评论 -
Differences between the C Locale and the C++ Locales
From:http://stdcxx.apache.org/doc/stdlibug/24-3.htmlApache C++ Standard Library User's Guide24.3 Differences between the C Locale and the C++ LocalesAs we have seen so far, the C locale转载 2012-12-24 11:08:39 · 773 阅读 · 0 评论 -
Why does wide file-stream in C++ narrow written data by default?
From: http://stackoverflow.com/questions/1509277/why-does-wide-file-stream-in-c-narrow-written-data-by-defaultHonestly, I just don't get the following design decision in C++ St转载 2012-12-24 09:36:43 · 807 阅读 · 0 评论 -
Custom draw vs Owner draw
From: http://www.codeproject.com/KB/miscctrl/CustomDrawCSliderCtrl.aspxhttp://www.codeproject.com/Articles/8985/Customizing-the-Appearance-of-CSliderCtrl-Using-Cu"Custom Draw" is a featu转载 2012-12-03 21:21:42 · 605 阅读 · 0 评论 -
Why does my OSG MFC based application show memory leaks
From: http://www.vis-sim.com/3dsceneBB/viewtopic.php?t=1027There is a known issue/BUG with MFC, were MFC makes a call to _CrtDumpMemoryLeaks() in the destructor of the _AFX_DEBUG_STATE, followed b转载 2012-12-02 16:27:37 · 671 阅读 · 0 评论 -
MFC和使用Std的dll之间的内存泄露误报情况
From: http://blog.sina.com.cn/s/blog_4087d260010090sf.html最近搞一个Delta3D的工程,因为牵扯到要放在MFC中,所以费了牛劲才找到放到MFC中的方法,结果还未等高兴,就发现了内部泄漏,泄漏的地方是dtCore.dll,这个DLL是静态关联的DLL,所以我看了看泄漏的具体对象,发现都和std之流相关,于是极度怀疑是st转载 2012-12-02 16:16:47 · 1451 阅读 · 1 评论 -
Exporting classes containing std:: objects (vector, map, etc) from a dll
From: http://www.abstraction.net/ViewArticle.aspx?articleID=83Related readings:http://stackoverflow.com/questions/767579/exporting-classes-containing-std-objects-vector-map-etc-from-a-dllh转载 2012-11-05 13:52:44 · 539 阅读 · 0 评论 -
跨dll访问STL
From: http://blog.youkuaiyun.com/lqk1985/article/details/3136909问题:跨dll,针对Vector引用的传递没有问题,但是Map就出现问题了。原因分析:一句话-----如果任何STL类使用了静态变量(无论是直接还是间接使用),那么就不要再写出跨执行单元访问它的代码。 除非你能够确定两个动态库使用的都是同样的STL实现,比如都转载 2012-11-04 16:18:28 · 474 阅读 · 0 评论 -
Implementing a Thread-Safe Queue using Condition Variables
From: http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.htmlOne problem that comes up time and again with multi-threaded code is how to转载 2012-07-28 21:50:24 · 1029 阅读 · 0 评论 -
Strategies for Implementing POSIX Condition Variables on Win32
From:http://www.cs.wustl.edu/~schmidt/win32-cv-1.htmlStrategies for Implementing POSIX Condition Variables on Win32Douglas C. Schmidt and Irfan PyaraliDepartment of Computer ScienceWashi转载 2012-07-28 22:38:07 · 907 阅读 · 0 评论 -
使用Gflags来检测heap问题
From: http://www.cppblog.com/tgh621/archive/2011/01/17/138663.html如果你是C++程序员,如果你写过一个很复杂的程序,如果你经常碰到莫名其妙的崩溃问题。那么你就有可能遭遇了野指针。如果你比较细心,注意了Debug Output输出窗口的话,那么你就有可能注意到这样一行提示:HEAP: Free Heap转载 2011-11-17 21:03:45 · 441 阅读 · 0 评论 -
创建和销毁过程几个函数的执行顺序
From: http://blog.youkuaiyun.com/csw_100/article/details/48069571:对象生成后 函数执行顺序首先执行 构造函数-> Create->PreSubclassWindow()->OnCreate()->OnInitDialog()Create 创建窗口,发出WM_CREARE消息。 OnCreate 响应W转载 2011-11-15 14:01:05 · 781 阅读 · 0 评论 -
GetCurrentThread() returns pseudo handle, not the real handle.
From: http://weseetips.com/tag/pseudo-handle/For getting our thread handle, we usually call GetCurrentThread() api. But actually it returns a pseudo handle. A pseudo handle, is a special handle转载 2011-11-13 20:14:00 · 607 阅读 · 0 评论 -
关于MinGW下.dll.a文件的作用
.dll.a文件的最初用意其实是MinGW下的DLL文件的imp-lib,即与VC下DLL文件附带了一个引入库.lib类似。在VC下编程,当要使用DLL文件时,在开发时必须要有.lib文件才能链接通过。.dll.a文件就是这样的作用。 但是,MinGW/Cygwin确提供了直接与.dll文件链接的作用,就是可以不需要imp-lib库文件,只要DLL文件存在,也可以链接成功。这样就导致原创 2010-03-14 14:45:00 · 17402 阅读 · 0 评论 -
MSVC vs. MinGW 之 (lib,dll,def,obj,exe) vs (a,dll,def,o,exe)
From: http://hi.baidu.com/kaien_space/blog/item/ae765e0aa3de501695ca6bb9.html MinGW:c -> o gcc -c a.cc -> exe gcc a.c libs.o -o a.exe (从主程序a.c,附加libs,生成a.exe)o -> exe转载 2010-03-12 18:38:00 · 969 阅读 · 0 评论 -
GCC4.4.0环境变量设置
C_INCLUDE_PATH=%MINGW_HOME%/include;%MINGW_HOME%/lib/gcc/mingw32/4.4.0/include CPLUS_INCLUDE_PATH=%MINGW_HOME%/lib/gcc/mingw32/4.4.0/include/c++;%MINGW_HOME%/lib/gcc/mingw32/4.4.0/include/c++原创 2010-03-12 15:26:00 · 624 阅读 · 0 评论 -
GCC4.4.0在MinGW下中文显示乱码的问题
新版的gcc 4.4.0默认是多国语言的,但是在win下面是直接输出的utf8字符,所以变成乱码了。 将环境比变量LANG随便设置一下,例如LANG=en,就可以改为英文显示。原创 2010-03-12 14:14:00 · 1609 阅读 · 0 评论 -
C++函数调用方式(_stdcall, _pascal, _cdecl...)总结
From: http://blog.youkuaiyun.com/pizi0475/archive/2010/02/20/5312357.aspx __stdcall: _stdcall 调用约定相当于16位动态库中经常使用的PASCAL调用约定。在32位的VC++5.0中PASCAL调用约定不再被支持(实际上它已被定义为__stdcall。除了__pascal外,__fortra转载 2010-03-11 12:01:00 · 492 阅读 · 0 评论 -
C++开源跨平台类库集
From: http://www.gameluna.com/shownews.asp?id=144http://blog.youkuaiyun.com/atomic_age/archive/2006/08/09/1043122.aspx C++开源跨平台类库集在如下的库支持下,开发的系统可以很方便移植到当前大部分平台上运行而无需改动,只需在对应的平台下 用你喜欢的编译器 重新编译即可 经典的C转载 2010-03-05 16:58:00 · 940 阅读 · 0 评论 -
使用wxWidgets开发应用程序时的VC++配置
From: http://www.wxwidgets.org/docs/technote/vc_ide.htm To compile wxWidgets samples and applications using the VC++ 5.0 or 6.0 IDE (having compiled wxWidgets using the makefile or project file pr转载 2010-03-05 16:33:00 · 716 阅读 · 0 评论 -
C++虚继承内存对象模型探讨
From: http://hi.baidu.com/absolute8511/blog/item/2846613d0fb29ae73d6d978f.html C++虚继承内存对象模型探讨最近看了下Inside C++里面讲的对虚继承层次的对象的内存布局,发现在不同编译器实现有所区别。因此,自己动手探索了一下。结果如下:首先,说说GCC的编译器.它实现比较简单,不管是否虚继承,G转载 2009-10-24 15:09:00 · 513 阅读 · 0 评论