CppCheck是一个C/C++代码缺陷静态检查工具。不同于C/C++编译器及其它分析工具,CppCheck只检查编译器检查不出来的bug,不检查语法错误。所谓静态代码检查就是使用一个工具检查我们写的代码是否安全和健壮,是否有隐藏的问题。 比如无意间写了这样的代码: [cpp] view plain Read More
posted @ 2016-02-12 21:50 findumars Views(4185) Comments(0) Diggs(0)
在main函数之前跑代码的方法 方法: 手工找到程序入口点, 替换为我们自己的函数 [cpp] view plain copy 写测试程序 // test.cpp : Defines the entry point for the console application. // #include " Read More
posted @ 2016-02-12 21:31 findumars Views(632) Comments(0) Diggs(0)
[cpp] view plain copy // test.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <windows.h> #include <crtdbg. Read More
posted @ 2016-02-12 21:28 findumars Views(678) Comments(0) Diggs(0)
实验原因 说明如何使用const描述保护类数据不会意外修改. 编译环境 vc6sp6 + win7x64 工程下载 copyConstruction_constMemberFunction.zip 使用非const成员函数,引起的拷贝构造函数报错 [cpp] view plain copy clas Read More
posted @ 2016-02-12 21:27 findumars Views(769) Comments(0) Diggs(0)
[cpp] view plain copy #include <iostream> #include <limits> using namespace std; #define SAFE_DELETE(x) \ { \ if (NULL != (x)) \ { \ delete (x); \ (x) Read More
posted @ 2016-02-12 21:25 findumars Views(1548) Comments(0) Diggs(0)
测试程序功能 打印出自己进程的程序入口点地址. 结合OD载入程序,看到的入口点确实是0x004014f0, 说明程序入口点找到了 测试程序 [cpp] view plain copy /// @file exam_1_1.c #include <stdlib.h> #include <stdio.h Read More
posted @ 2016-02-12 21:23 findumars Views(244) Comments(0) Diggs(0)
原理分析 当调用一个虚函数时, 编译器生成的代码会调用 虚表地址[0](param1, param2)这样的函数. 已经不是在调用函数名了. 当我们将虚表地址[n]中的函数实现改为另外的函数, 虚函数的实现就由我们来控制了. 实验 根据虚表原理, 实验一下修改自己程序的虚函数表项地址. 使编译器生成 Read More
posted @ 2016-02-12 21:22 findumars Views(390) Comments(0) Diggs(0)
C语言标准是没有 try-catch语法 的, M$家自己提供了一组. [cpp] view plain copy /// @file ClassroomExamples.c /// @brief 验证C语言的非标准try, catch #include <windows.h> #include < Read More
posted @ 2016-02-12 21:17 findumars Views(604) Comments(0) Diggs(0)
围观M$的new 对于new一个类, M$为了拷贝和移动时的效率问题, 使用了非标准的new语法, 为了兼容性, 只能围观. http://blog.csdn.net/lostspeed/article/details/50458432 Read More
posted @ 2016-02-12 21:15 findumars Views(254) Comments(0) Diggs(0)
前言 庖丁解牛 - <<庄子>>庖丁为文惠君解牛,手之所触, 肩之所倚, 足之所履, 膝之所踦, 砉然向然, 奏刀騞然, 莫不中音, 合于《桑林》之舞, 乃中《经首》之会.文惠君曰:"嘻, 善哉! 技盍至此乎?"庖丁释刀对曰:"臣之所好者, 道也, 进乎技矣.始臣之解牛之时, 所见无非牛者.三年之后 Read More
posted @ 2016-02-12 21:10 findumars Views(851) Comments(0) Diggs(0)
测试函数的模板实现 [cpp] view plain copy /// @file my_template.h /// @brief 测试数据类型用的模板实现 #ifndef MY_TEMPLATE_H_2016_0123_1226 #define MY_TEMPLATE_H_2016_0123_1 Read More
posted @ 2016-02-12 21:09 findumars Views(1228) Comments(0) Diggs(0)
[cpp] view plain copy /// @file main.cpp /// @brief 不包含SDK头文件, 补全API定义 #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define DECLARE_HANDLE Read More
posted @ 2016-02-12 21:06 findumars Views(573) Comments(0) Diggs(0)
前言 本来可以从俄罗斯方块控制台版改一版, 将UI接口换掉, 变成SDK版. 正好放假了, 有时间. 就用了一个星期来重头做一个新版, 享受一下静下心来, 有条不紊干活的感觉^_^ 这个工程用来验证SDK编程中对消息循环, UI绘制, 局部刷新的理解. 做这么个东西, 以自己为用户, 玩起来还是挺耐 Read More
posted @ 2016-02-12 21:04 findumars Views(551) Comments(0) Diggs(0)
头文件: #ifndef GLABEL_H #define GLABEL_H #include <QLabel> #include <QPainter> #include <QPaintEvent> #include <QMouseEvent> class GLabel : public QLabe Read More
posted @ 2016-02-12 19:45 findumars Views(5574) Comments(0) Diggs(0)
不会灵活使用函数指针,就不算掌握C语言 Read More
posted @ 2016-02-12 18:08 findumars Views(358) Comments(0) Diggs(0)
C++ 通过以下几个类支持文件的输入输出: ofstream: 写操作(输出)的文件类 (由ostream引申而来) ifstream: 读操作(输入)的文件类(由istream引申而来) fstream: 可同时读写操作的文件类 (由iostream引申而来) 打开文件(Open a file) Read More
posted @ 2016-02-12 16:57 findumars Views(840) Comments(0) Diggs(1)