摘要:
因工作需要,需要研究一下Windows驱动开发。我们知道,编译驱动程序主要是通过两种方案:第一种是通过WinDDK提供的build命令+source文件进行编译;另外一种是通过VC的IDE进行编译。 微软推荐开发者使用第一种,即利用WinDDK提供的编译命令进行编译,但是,本质上,两种方法到最后都是调用cl.exe和link.exe进行编译,区别只是两种方法设置参数、环境变量的方式不同而已。 环境... 阅读全文
摘要:
话说玩C++的,都肯定知道面向对象的多态性。而要搞清楚多态,又不得不接触虚表(Virtual Table)。 虚表的结构 虚表的结构很简单,就是单纯的虚函数指针数组,没有别的条目。 看一个例子,有如下代码: class IUnknown{public: virtual long AddRef() = 0; virtual long Release() = 0;private:};cl... 阅读全文
摘要:
基于C++模板编程,我们可以将一部分计算放到编译期来完成,还能够给编写代码带来很多方便。比如题目中提到的,利用C++模板技术求各整数类型的最大最小值。代码如下:// indicates T is signed or unsignedtemplate< typename T > struct TFSigned{ enum { fSigned = T(-1) < 0 };}; // represents the bit length of Ttemplate< typename T > struct TBitCount{ enum { cBits = sizeof( 阅读全文
摘要:
This two call convention puzzels me since I knew them. MSDN explanations as below: _stdcall The __stdcall calling convention is used to call Win32 API functions. The callee cleans the stack. _cdecl ... 阅读全文
摘要:
Problem Description The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will 阅读全文
摘要:
Problem Description Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed. 37 36 35 34 33 32 3138 17 16 15 14 13 3039 18 5 4 3 12 2940 19 6 1 ... 阅读全文
摘要:
Problem Description Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, aste... 阅读全文
摘要:
Problem Description It is possible to show that the square root of two can be expressed as an infinite continued fraction. sqrt(2) = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213... By expanding this f... 阅读全文
摘要:
Problem Description A googol (10100) is a massive number: one followed by one-hundred zeros; 100100 is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the... 阅读全文
摘要:
Problem Description If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Not all numbers produce palindromes so quickly. For example, 349 + 943 = 1292,1292 + 2921 = 42134213 + 3124 = 7... 阅读全文