11 2015 档案

摘要:第6章 深入函数函数是一种“第一类值(First-Class Value)”,他们具有特定的词法域(lexical scoping)将表达式“function(x) end”视为一种函数的构造式,就像table的构造式{}一样。function foo(x) return 2*x end --> ... 阅读全文
posted @ 2015-11-23 22:50 Through 阅读(157) 评论(0) 推荐(0)
摘要:第1章:起点Chunks: 语句块每个语句结尾的分号是可选的,如果同一行有多个语句最好使用分号分隔;dofile("lib1.lua") -- 执行lua文件全局变量:局部变量用local修饰,否则就是全局变量保留字: if then else elseif end and or not fucti... 阅读全文
posted @ 2015-11-15 22:28 Through 阅读(317) 评论(0) 推荐(0)
摘要:http://download.eclipse.org/ldt/releases/milestones/百度一下都说是 http://download.eclipse.org/koneki/updates-nightly/ldt ,人都得被坑死,更新不了。 阅读全文
posted @ 2015-11-15 15:45 Through 阅读(210) 评论(0) 推荐(0)
摘要:编译lua包含3部分内容:lua库文件(lua*.lib),lua解释器(lua.exe),lua编译器(luac.exe)首先:下载源代码,编译批处理(以5.2.3为例):cd srccl /O2 /W3 /c /DLUA_BUILD_AS_DLL l*.cdel lua.obj luac.obj... 阅读全文
posted @ 2015-11-15 14:52 Through 阅读(268) 评论(0) 推荐(0)
摘要:面向对象的五大原则,又称S.O.L.I.D原则:S(SRP, Single Reponsibility Principle): 单一职责原则,一个类应有且只有一个职责(或只有一个引起其变化的原因)O(OCP, Open/Close Principle): 对扩展开放,对修改封闭。L(LSP, Lis... 阅读全文
posted @ 2015-11-14 23:13 Through 阅读(229) 评论(0) 推荐(0)
摘要:还是学习VLD2.X版本看到的:在Windows XP及之前的操作系统没有提供GetProcessIdOfThread的API,这里给出了一个替代的实现方式:头文件:#if _WIN32_WINNT < 0x0600 // Windows XP or earlier, no GetProcessId... 阅读全文
posted @ 2015-11-14 22:39 Through 阅读(913) 评论(0) 推荐(0)
摘要:学习VLD2.0代码,看到如下函数:HMODULE GetCallingModule( UINT_PTR pCaller ){ HMODULE hModule = NULL; MEMORY_BASIC_INFORMATION mbi; if ( VirtualQuery((LPCVOID)pCall... 阅读全文
posted @ 2015-11-14 22:30 Through 阅读(518) 评论(0) 推荐(0)
摘要:0X01 关闭FPO优化// Frame pointer omission (FPO) optimization should be turned off for this// entire file. The release VLD libs don't include FPO debug inf... 阅读全文
posted @ 2015-11-09 22:37 Through 阅读(442) 评论(0) 推荐(0)
摘要:学习VLD1.0代码,发现Release版本的代码_DEBUG宏是已定义的,查找工程配置确只有NDEBUG宏的定义,不见_DEBUG的踪影。好吧,最后发现是由于工程Code Generation选项使用的Debug的RT库,其就相当于定义_DEBUG宏。呵呵~~~相当隐晦。 阅读全文
posted @ 2015-11-08 22:40 Through 阅读(195) 评论(0) 推荐(0)
摘要:// The release libs don't include FPO debug information, so FPO// optimization will interfere with stack walking.#pragma optimize ("y", off) 阅读全文
posted @ 2015-11-08 22:21 Through 阅读(310) 评论(0) 推荐(0)
摘要:VC中,如果隐式链接的lib或dll未被引用,编译器并不会去生成加载该lib或dll的代码,从VLD1.0版本中看到可以通过如下方式强制引用:// Force a symbolic reference to the global VisualLeakDetector class object fro... 阅读全文
posted @ 2015-11-07 23:15 Through 阅读(269) 评论(0) 推荐(0)
摘要:近期想学习下VLD的实现,打算从最简单的V1.0版本看起。以下是V1.0版本自己尝试翻译下,最新的2.x版本似乎强大了很多。简介 Visual C++提供了内置的内存检测机制,但其充其量只满足了最小定位需求。VLD工具定位为内置内存泄漏的替代,提供了如下特性:泄漏内存块的全调用栈回溯,包括文件及其... 阅读全文
posted @ 2015-11-07 22:04 Through 阅读(399) 评论(0) 推荐(0)
摘要:Visual Studio 2005 This topic describes how to set up C++ applications to target 64-bit platforms using project configurations available in the Visual Studio Integrated Development Environment (IDE)... 阅读全文
posted @ 2015-11-07 16:54 Through 阅读(433) 评论(0) 推荐(0)
摘要:1. 使能内存泄漏检测#define _CRTDBG_MAP_ALLOC#include #include 注1:语句顺序不能修改;注2:仅对DEBUG版本有效注3:#define语句可以去掉,但leak dump会丢失细节信息,如:泄漏的代码文件及行号2. 打印泄漏内存报告在合适的地方调用下面的语... 阅读全文
posted @ 2015-11-07 16:42 Through 阅读(1353) 评论(0) 推荐(0)